Logo
(追記) (追記ここまで)

18748번 - Grp 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
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

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2020 > Day 7: Gennady Korotkevich Contest 5 G번

Contest > Open Cup > 2019/2020 Season > Stage 11: Grand Prix of Gomel G번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /