No.2282 Boxed Nim
問題文最終更新日: 2023-04-29 09:55:52
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
yukicoder contest 386
(順位表)
の他の問題:
Problem Statement
There are $N$ boxes, and the $i$-th box contains $A_i$ stones. Initially, the lids of all boxes are closed.
Two players play a game using these boxes. Starting with the first player, the two players alternately perform one of the following operations.
- Choose one box whose lid is closed and open its lid.
- Choose one box whose lid is open and which contains at least one stone, and remove one or more stones from the box.
The player who first becomes unable to perform an operation loses, and the other player wins.
Determine which player wins the game when both players act optimally.
Input
$N$ $A_1 \ A_2 \ \cdots \ A_N$
- All input values are integers.
- $1 \le N \le 10^5$
- $0 \le A_i \le 10^9$
Output
Print First if the first player wins, and Second if the second player wins.
Sample
Sample 1
Input
3 0 1 2
Output
First
Here is one example of how the game may proceed.
- The first player opens the $2$-nd box.
- The second player opens the $1$-st box.
- The first player takes $1$ stone out of the $2$-nd box.
- The second player opens the $3$-rd box.
- The first player takes $2$ stones out of the $3$-rd box.
After that, the second player cannot perform an operation, so the first player wins.
Sample 2
Input
2 1 1
Output
Second
Sample 3
Input
8 2 0 2 3 0 2 1 0
Output
First
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
cureskol