QOJ.ac

QOJ

시간 제한: 1.0 s 메모리 제한: 64 MB 총점: 100

#17898. 托儿所的孩子们

통계

苏菲在一家托儿所工作。她的组里有 $n$ 个孩子,每个孩子都应该分到一套包含至少 $k$ 种不同类型玩具的集合——孩子们对玩具的种类或同种玩具没有偏好。玩具一共有 $\lfloor \frac{3k^2}{2} \rfloor$ 种不同的类型,苏菲可以无限量地获取每种类型的玩具。孩子们喜欢两两一起玩耍,为了让一对孩子能够一起玩耍,必须恰好只有一种类型的玩具是他们两人都拥有的;否则,如果他们没有任何共同种类的玩具,他们就很难一起玩,或者如果他们有多种共同种类的玩具,他们会感到困惑。此外,每个孩子都希望自己是特别的,因此没有任何两个孩子可以拥有完全相同的一套玩具种类。帮助苏菲完成她的工作:编写一个程序,为每个孩子计算出其玩具种类的集合,使得每对孩子都可以一起玩耍。

输入格式

输入的第一行包含两个由空格隔开的正整数 $n$ 和 $k$($1 \le n \le \binom{k}{2}$,$2 \le k \le 50$)。

输出格式

输出应包含 $n$ 行。第 $i$ 行应以一个自然数 $k_i$ 开始,表示第 $i$ 个孩子分到的玩具数量,后接一个空格,然后是 $k_i$ 个两两不同的玩具种类(即来自集合 $\{1, 2, \dots, \lfloor \frac{3k^2}{2} \rfloor\}$ 的自然数),它们之间用空格隔开。

样例

输入 1

3 3

输出 1

4 10 1 2 13
3 1 3 4
6 1 5 6 7 8 9

输入 2

5 4

输出 2

4 1 2 3 13
4 1 4 7 10
4 4 5 6 13
4 7 8 9 13
4 10 11 12 13

说明

在第一个样例中,有三个孩子,每个孩子应该从总共 $\lfloor \frac{3 \cdot 3^2}{2} \rfloor = 13$ 种玩具($1, 2, \dots, 13$)中分到至少三种玩具。在给出的解中,每对孩子都共同拥有一种类型为 $1$ 的玩具(且没有其他共同玩具)。

在第二个样例中,有五个孩子,每个孩子分到至少四种不同的玩具,玩具共有 $\lfloor \frac{3 \cdot 4^2}{2} \rfloor = 24$ 种($1, 2, \dots, 24$)。在给出的解中,不包含第二个孩子的孩子对共同拥有玩具 $13$;而第二个孩子分别与第一个、第三个、第四个和第五个孩子组成的对,共同拥有的玩具种类分别为 $1, 4, 7, 10$。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.