Grp
시간 제한5초메모리 제한512 MB
n개 문자로 만든 크기 k 이하의 모든 공집합 아닌 부분집합을, 한 묶음 안의 부분집합들이 서로소이고 크기 합이 k 이하가 되도록 최소 개수의 묶음으로 나눈다.
문제
Distribute all non-empty subsets of {a, b, c, . . .} (first n lowercase English letters) of size at most k into as few groups as possible, subject to the following conditions:
- each subset must belong to exactly one group;
- subsets belonging to the same group must have no common elements;
- the total size of subsets belonging to the same group must be at most k
입력
The only line contains two integers n and k (1 ≤ k ≤ n ≤ 17).
출력
Display the smallest number of groups g, followed by g group descriptions.
Group description i must consist of an integer si, followed by si subset descriptions. Each subset description must be a string containing subset elements in any order without spaces.