CF1903E.Geo Game

普及+/提高

通过率:0%

时间限制:2.50s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

This is an interactive problem.

Theofanis and his sister are playing the following game.

They have nn points in a 2D plane and a starting point (sx,sy)(s_x,s_y). Each player (starting from the first player) chooses one of the nn points that wasn't chosen before and adds to the sum (which is initially 00) the square of the Euclidean distance from the previous point (which is either the starting point or it was chosen by the other person) to the new point (that the current player selected).

The game ends after exactly nn moves (after all the points are chosen). The first player wins if the sum is even in the end. Otherwise, the second player wins.

Theofanis is a very competitive person and he hates losing. Thus, he wants to choose whether he should play first or second. Can you show him, which player to choose, and how he should play to beat his sister?

这是一个交互式问题。

西奥法尼斯和他的妹妹正在玩以下游戏:

他们在二维平面上有 nn 个点,以及一个起始点 (sx,sy)(s_x,s_y)。每名玩家(从先手玩家开始)轮流选择一个尚未被选过的点(共 nn 个点中的一个),并将该点与上一个点(若为第一步,则上一个点即为起始点 (sx,sy)(s_x,s_y);否则为对方上一轮所选的点)之间的欧几里得距离的平方加到总和中(初始总和为 00)。

游戏恰好进行 nn 轮(即所有 nn 个点均被选完后)结束。若最终总和为偶数,则先手玩家获胜;否则,后手玩家获胜。

西奥法尼斯是一个极具竞争意识的人,他非常讨厌失败。因此,他希望决定自己应该选择先手还是后手。你能告诉他应选择哪一方,并给出必胜策略,以确保他战胜妹妹吗?

输入格式

The first line contains a single integer tt (1≤t≤20001 \le t \le 2000) — the number of test cases.

The data for each test case is only available after the end of the interaction (the end of the game) for all previous test cases.

The first line of each test case contains a single integer nn (1≤n≤1051 \le n \le 10^{5}) — the number of points.

The second line of each test case contains two integers sxs_x, sys_y (0≤sx,sy≤1090 \le s_x, s_y \le 10^{9}) — the coordinates of the starting point.

Two or more points may have the same coordinates.

The ii-th of the following nn lines contains two integers xix_i and yiy_i (0≤xi,yi≤1090 \le x_i, y_i \le 10^{9}) — the coordinates of the ii-th point.

It is guaranteed that the sum of nn over all test cases does not exceed 10510^{5}.

第一行包含一个整数 tt(1≤t≤20001 \le t \le 2000)—— 表示测试用例的数量。

每个测试用例的数据仅在所有先前测试用例的交互(即游戏)结束后才可用。

每个测试用例的第一行包含一个整数 nn(1≤n≤1051 \le n \le 10^{5})—— 表示点的数量。

每个测试用例的第二行包含两个整数 sxs_x、sys_y(0≤sx,sy≤1090 \le s_x, s_y \le 10^{9})—— 表示起点的坐标。

两个或更多点可能具有相同的坐标。

接下来的 nn 行中,第 ii 行包含两个整数 xix_i 和 yiy_i(0≤xi,yi≤1090 \le x_i, y_i \le 10^{9})—— 表示第 ii 个点的坐标。

保证所有测试用例的 nn 之和不超过 10510^{5}。

输入输出样例

  • 输入#1

    2
    6
    4 6
    7 6
    8 5
    2 1
    6 2
    6 4
    3 3
    
    2
    
    5
    
    1
    4
    1 1
    3 2
    2 1
    3 3
    1 2
    
    
    2
    
    3

    输出#1

    Second
    
    4
    
    6
    
    3
    First
    1
    
    4

说明/提示

The examples above do not necessarily showcase optimal strategies or the correct player to choose.

In the picture below, you can see the moves that each player made in the first example. The first player is red, and the second player is black.

上述示例未必展示了最优策略,也未必表明应选择哪位玩家获胜。

在下方图片中,您可以查看第一个示例中每位玩家所走的棋步。先手玩家为红色,后手玩家为黑色。

输入解题思路,AI测评打分。不知道怎么写?

首页