QOJ.ac

QOJ

時間限制: 2 s 記憶體限制: 512 MB 總分: 100

#7263. 团队竞赛

统计

$N$ 个人想要为即将到来的团队比赛进行练习。Snuke 想要安排练习计划。该计划需要满足以下条件:

  • 练习的天数在 $1$ 到 $N^2$ 之间(包含 $1$ 和 $N^2$)。
  • 每天恰好有 $N$ 个人中的 $3$ 个人参加练习。
  • 设 $f(p, q)$ 为两人 $p$ 和 $q$ 同时参加练习的天数。对于所有不同的两人组合 $(p, q)$,$f(p, q)$ 的值必须相同。

输入格式

输入包含一个整数 $N$ ($3 \le N \le 1000$)。

输出格式

如果不存在满足条件的计划,请在单行中输出 $-1$。

否则,请按以下格式输出满足条件的计划。第一行必须包含练习的天数 $K$;接下来的 $K$ 行中,第 $i$ 行包含第 $i$ 天参加练习的 $3$ 个人的编号 $x_i, y_i, z_i$。人员编号为 $1$ 到 $N$。如果存在多种满足条件的计划,输出其中任意一个即可。

样例

输入 1

5

输出 1

10
1 2 3
1 2 4
1 2 5
1 3 4
1 3 5
1 4 5
2 3 4
2 3 5
2 4 5
3 4 5

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.