No.3586 Divide and Be Conquered
Problem Statement
There are $N$ piles, and pile $i$ contains $A_i$ stones.
$2$ players play a game using these piles. Starting with the first player, they alternately perform the following operation† $1$ time on the current set of piles.
- The player whose turn it is chooses $1$ pile containing $2$ or more stones.
-
The opponent splits that pile into $2$ piles, each containing $1$ or more stones.
That is, letting $x$ be the number of stones in the chosen pile, the pile is split into a pile of $a$ stones and a pile of $b$ stones, using positive integers $a,b$ such that $x=a+b$. - The player whose turn it is chooses one of the $2$ split piles and removes it. The other pile remains as it is.
A player who cannot perform the operation loses.
You are given $T$ test cases. For each test case, determine which player wins, the first player or the second player, when both play optimally.
† In this problem, steps 1, 2, 3 above are collectively called "1 operation".
Constraints
- $1 \leq T \leq 10^5$
- $1 \leq N$
- $1 \leq A_{i} \leq 10^{18}$
- The sum of $N$ over all test cases is at most $2 \times 10^5$
- $T$, $N$, $A_{i}$ are integers
Input
The input is given from standard input in the following format. Here, the $t\ (1 \leq t \leq T)$-th test case is denoted by $\mathrm{case}_t$.
$T$
$\mathrm{case}_1$
$\mathrm{case}_2$
$\vdots$
$\mathrm{case}_T$
Each test case is given in the following format.
$N$ $A_1$ $A_2$ $\dots$ $A_N$
Here, $N$ is the number of piles in that test case, and $A_i$ is the number of stones in the $i$-th pile in that test case.
Output
Output $T$ lines. For each test case, print First on 1 line if the first player wins,
and Second if the second player wins.
Sample
Sample 1
Input
4 1 1 1 2 1 4 3 2 3 7
Output
Second First Second First
In the $1$st test case, there is only a pile with $1$ stone, so the first player cannot perform the operation and loses.
In the $2$nd test case, the first player chooses the pile with $2$ stones.
The second player has no choice but to split it into piles of $1$ stone and $1$ stone.
After that, the first player removes one of them, leaving only a pile with $1$ stone.
The second player cannot perform the operation and loses.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
siganai