시간 제한메모리 제한제출정답맞힌 사람정답 비율
5 초 512 MB74457.143%

문제

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.

예제 입력 1

3 2

예제 출력 1

5
1 ab
1 ac
1 bc
1 b
2 c a

예제 입력 2

3 3

예제 출력 2

4
1 abc
2 ab c
2 ac b
2 bc a