QOJ.ac

QOJ

Limite de temps : 2 s Limite de mémoire : 1024 MB Points totaux : 100 Interactif

#4663. 算术游戏

Statistiques

这是一个交互式问题。

游戏开始时,黑板上写着 $2n$ 个连续的整数。Alice 和 Bob 轮流进行操作,Alice 先手。每次操作包括擦除黑板上剩余的一个整数。在经过 $2n - 2$ 次操作后,黑板上将只剩下两个整数。如果这两个整数的最大公约数(GCD)不等于 1,则 Alice 获胜,否则 Bob 获胜。

Bob 想要在这场游戏中击败 Alice,并请求你编写一个程序来帮助他。

交互

首先,评测程序会告诉你一个整数 $n$ ($1 \le n \le 10^5$),它定义了数组的大小。初始时,黑板上有 $2n$ 个整数。

随后进行 $n-1$ 轮操作,每轮包含以下两个动作:评测程序输出一个 $1$ 到 $2n$ 之间的整数,表示 Alice 擦除的数字;你的程序需要输出一个尚未被擦除的整数,表示 Bob 擦除的数字。尝试擦除一个已经被擦除的数字会立即导致 Wrong Answer 错误。

如果最后剩下的两个整数的最大公约数为 1,则你获胜。否则你将失败并收到 Wrong Answer。

样例

样例输入 1

2
4

样例输出 1

2

样例输入 2

5
5
9
3
8

样例输出 2

6
4
2
1

说明

请记得在每次操作后输出换行符并刷新缓冲区。

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.