QOJ.ac

QOJ

时间限制: 1.0 s 内存限制: 256 MB 总分: 100 可 Hack ✓

#9954. 魔法点

统计

给定一个整数 $n$,如果一个二维平面上的点 $(x, y)$ 满足 $x$ 和 $y$ 均为整数,且恰好满足以下条件之一,则称其为魔法点:

  • $0 \le x < n$ 且 $y = 0$;
  • $0 \le x < n$ 且 $y = n - 1$;
  • $x = 0$ 且 $0 \le y < n$;
  • $x = n - 1$ 且 $0 \le y < n$。

容易发现,总共有 $(4n - 4)$ 个魔法点。这些魔法点从 $(0, 0)$ 开始按逆时针方向编号为 $0$ 到 $(4n - 5)$。

DreamGrid 可以利用这些魔法点创建 $n$ 条魔法线。每条魔法线恰好经过两个魔法点,且不能与直线 $x = 0$ 或 $y = 0$(即坐标轴)平行。

魔法线的交点被称为梦想点。出于某种原因,DreamGrid 希望尽可能多地制造梦想点。你能告诉他如何创建这些魔法线吗?

输入格式

输入包含多组测试数据。第一行包含一个整数 $T$(约 $100$),表示测试数据的组数。对于每组测试数据,仅包含一个整数 $n$ ($2 \le n \le 1000$)。

输出格式

对于每组数据,输出一行包含 $2n$ 个整数 $p_1, p_2, \dots, p_{2n}$,用空格分隔,表示在你的方案中,点 $p_{2k-1}$ 和点 $p_{2k}$ 之间连接一条线,对于所有 $1 \le k \le n$。

如果存在多种答案,你可以输出其中任意一种。

样例

输入 1

3
2
3
4

输出 1

0 2 1 3
1 4 2 5 3 6
0 6 1 9 3 8 4 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.