QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 512 MB Points totaux : 100 Interactif

#4301. 点与线段

Statistiques

这是一个交互式问题。

Alice 和 Bob 在枯燥的几何课上玩一个名为“点与线段”的新游戏。

游戏板是一张纸,上面有 $n$ 个不同的点,其中任意三点都不共线。玩家轮流进行操作,Alice 先手。当前玩家的操作是选择两个点,并用一条线段将它们连接起来。新线段不得与之前的线段有公共的内部点(它们可以有公共的端点)。无法进行操作的玩家输掉比赛。

在本题中,你的程序将与评测程序进行“点与线段”游戏,且必须获胜。你的程序将获得一个包含 $n$ 个点的棋盘,并必须首先选择是代表 Alice 还是代表 Bob。之后,你的程序必须为你选择的玩家进行操作,直到获胜。

交互

首先,你的程序必须读取一个整数 $n$ —— 棋盘上的点数 ($3 \le n \le 300$)。

之后读取 $n$ 对整数 $(x_i, y_i)$ —— 点的坐标 ($-10^4 \le x_i, y_i \le 10^4$;所有点互不相同,且任意三点不共线)。

在分析完棋盘后,你的程序必须决定是作为 Alice 先手,还是作为 Bob 后手。如果想代表 Alice,输出 1;如果想代表 Bob,输出 2。别忘了在输出后换行。

之后,玩家根据你所做的选择轮流进行操作。如果是你方程序的回合,它应该在一行中输出两个整数:$i$ 和 $j$ —— 它想要连接的点的索引 ($1 \le i, j \le n$;$i$ 和 $j$ 必须不同,且该线段不得与现有的线段有公共的内部点)。如果是评测程序的回合,它会以相同的格式输出它的操作,你的程序必须从标准输入中读取它。

如果你的程序处于无法进行操作的情况,它将被评测系统强制终止。评测系统不会等待你的响应。如果你方程序获胜,且评测程序无法进行操作,评测程序将输出 0 0 而不是它的操作。你的程序必须读取这两个零并终止。

样例

样例 1

3
0 0
10 0
0 10
1
1 2
2 3
0 0

样例 2

4
0 0
10 0
5 7
5 3
2
1 4
2 4
3 4
0 0

说明

在上面的样例中,评测程序和参赛程序的输出为了展示响应关系而添加了空行。在实际交互中没有空行,请不要打印它们。但你必须在每条打印的消息末尾加上换行符。

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.