QOJ.ac

QOJ

Time Limit: 1.0 s Memory Limit: 1024 MB Total points: 100

#15473. Triple Fairness

统计

本题采用了与 H 题“公平题目集”(Fair Problemset)完全相同的定义。

ICPC 是一项团队竞赛。每支队伍有三名成员。在比赛开始时,大多数队伍会将 $3n$ 道题目平均分配。他们通常使用以下两种方法之一来分配题目:

  1. 顺序分配(Sequential Distribution):每名成员从 $3n$ 道题目中取走连续的 $n$ 道题。具体来说,第一名成员取走第 $1, \dots, n$ 道题,第二名成员取走第 $n + 1, \dots, 2n$ 道题,第三名成员取走第 $2n + 1, \dots, 3n$ 道题。
  2. 跳跃分配(Jump Distribution):每名成员取走 $3n$ 道题目中索引除以 3 的余数相同的题目。具体来说,第一名成员取走第 $1, 4, 7, \dots, 3n - 2$ 道题,第二名成员取走第 $2, 5, 8, \dots, 3n - 1$ 道题,第三名成员取走第 $3, 6, 9, \dots, 3n$ 道题。

ICPC 首尔区域赛科学委员会必须准备一套包含 $3n$ 道题的题目集。每道题的难度用 $1$ 到 $n$ 之间的整数表示。对于每个难度等级,恰好有三道题。因此,题目集中的难度排列可以看作是一个长度为 $3n$ 的难度序列,其中包含 $n$ 个难度等级,每个等级各出现三次。

为了防止队伍因选择的题目分配方式而产生优势或劣势,ICPC 首尔区域赛科学委员会定义了一个标准,称为“公平题目集”(Fair Problemset)。如果一个长度为 $3n$ 的难度序列满足以下两个条件,则称其为公平题目集:

  1. 顺序分配公平性:在使用顺序分配时,对于每个难度等级 $i$ ($1 \le i \le n$),三名成员中的每一位都恰好获得一道难度为 $i$ 的题目。
  2. 跳跃分配公平性:在使用跳跃分配时,对于每个难度等级 $i$ ($1 \le i \le n$),三名成员中的每一位都恰好获得一道难度为 $i$ 的题目。

换句话说,无论选择哪种分配方法,每名队员在每个难度等级(从 $1$ 到 $n$)上都必须恰好被分配到一道题目。

给定一个正整数 $n$,请编写一个程序,找出任意一个长度为 $3n$ 的公平题目集序列。

输入格式

程序从标准输入读取数据。输入仅包含一行,包含一个整数 $n$ ($1 \le n \le 200$; $n$ 不能被 3 整除)。可以证明,对于每一个合法的输入,都至少存在一个长度为 $3n$ 的公平题目集序列。

输出格式

程序向标准输出写入数据。输出一行,包含 $3n$ 个由空格分隔的正整数,表示一个长度为 $3n$ 的公平题目集序列。任何合法的公平题目集序列均可被接受。

样例

样例输入 1

2

样例输出 1

1 2 1 2 1 2

样例输入 2

4

样例输出 2

1 2 3 4 1 4 2 3 1 3 4 2

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.