| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 79 | 47 | 43 | 62.319% |
Alice and Bob are playing a modified game of Nim. Initially, there are some non-empty piles of stones in front of them. They take turns, and Alice takes the first turn.
On a single turn, a player must do the following actions in order:
Notice that after each valid move, there should be the same number of non-empty piles of stones as at the start of the game. A player who cannot perform all the actions on their turn loses the game.
You are given many games, and for each one, you'd like to determine who would win if both players play optimally.
The first line of input contains an integer $t$ (1ドル \leq t \leq 1,000円$), which is the number of games Alice and Bob play.
Each game is represented on two lines. The first line of each game contains an integer $n$ (2ドル \leq n \leq 50$), which is the number of piles of stones.
The next line of the game contains $n$ space-separated integers $s$ (1ドル \leq s \leq 10^{12}$), which are the number of stones in each pile.
Output $t$ lines. For each game, output a single line with a single integer, which is 1ドル$ if Alice wins and 0ドル$ if Bob wins. Assume Alice takes the first turn, and both players play optimally. Output the game results in the order the games appear in the input.
4 3 1 1 1 3 1 1 2 3 2 2 2 4 4 4 4 4
0 1 0 1
ICPC > Regionals > North America > North America Championship > North America Championship 2023 L번