QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 256 MB Total points: 100

#4797. Xormites

统计

考虑以下关于一个包含 $N$ 个整数的序列的双人游戏。两位玩家轮流进行操作。在每一轮中,当前玩家选择序列开头或结尾的一个值,将其加入到该玩家的异或和中,并从序列中移除该值。

这是一个众所周知的游戏。然而,在本题中,我们处理的是玩家将数值加入到异或和(XOR sum)而非普通和的情况。初始时,两位玩家的异或和均为 0,当加入新值时,使用按位异或运算代替加法。

当序列为空时游戏结束,此时异或和较大的玩家获胜。注意,游戏也可能以平局结束。假设玩家采取最优策略,请确定游戏的结局。

输入格式

第一行包含一个整数 $T$,表示测试用例的数量($1 \le T \le 12$)。每个测试用例的第一行包含一个整数 $N$($1 \le N \le 50\,000$),随后一行包含一个由 $N$ 个正整数组成的序列(序列中所有整数 $X$ 满足 $1 \le X \le 10^9$)。

输出格式

输出 $T$ 行,每行对应一个测试用例的结果。第 $i$ 行必须包含第 $i$ 个测试用例的答案。答案必须是以下之一:

  • “First”,如果先手玩家获胜。
  • “Second”,如果后手玩家获胜。
  • “Draw”,如果游戏以平局结束。

样例

输入 1

3
2
3 3
2
3 5
3
4 4 4

输出 1

Draw
First
Second

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.