바닥(3k^2/2)가지 장난감 종류에서 n명의 아이에게 서로 다른 k개 이상의 장난감 집합을 주되, 어느 두 아이도 정확히 한 종류만 공유하도록 배정한다.
어려움8조합론수학그리디구현아직 제출이 없습니다시간 제한2초메모리 제한64 MBSophie works at a daycare. There are n children in her group, each one should be given a set of at least k toys of different kinds--the children do not have preferences of toy kinds nor of toys of the same kind. Toys come in ⌊23k2⌋ different kinds and Sophie has access to unlimited supply of toys of each kind. Children like to play in pairs and for a pair of children to be able to play together, there has to be exactly one kind of toys such that both of them have a toy of this kind; otherwise either they have different kinds of toys and it is hard for them to play or they have a choice and they feel confused. Moreover, each child wants to be special and so no two children can have the same set of toy kinds. Help Sophie in her work: write a program which computes for each child its set of toy kinds, so that each pair of children can play together.
First line of the input consists of two space-separated positive integers n and k (1≤n≤(2k), 2≤k≤50).
You should write n lines to the output. The i-th line should begin with a natural number k_i: the number of toys that the i-th child gets, a single space and then a sequence of k_i pairwise different toy kinds--that is, natural numbers from the set 1,2,…,⌊23k2⌋, separated by cpaces
In first sample there are three children, each should be given at least three toys out of total ⌊23⋅32⌋=13 toy kinds: 1,2,…,13. In the given solution each pair of children has a toy of kind 1 in common (and no other).
In second sample there are five children and each is to be given at least four different toy kinds, the toys come in ⌊23⋅42⌋=24 kinds: 1,2,…,24. In the given solution the pairs of children that do not include the second child have the toy 13 in common, the pairs of the second child and, respectively, first, third, fourth, and fifth child have a common toy of the kind: 1,4,7,10, respectively.