Pinely Round 4 (Div. 1 + Div. 2) |
---|
Finished |
Alice and Bob are playing a game with $$$n$$$ piles of stones, where the $$$i$$$-th pile has $$$a_i$$$ stones. Players take turns making moves, with Alice going first.
On each move, the player does the following three-step process:
The player who is unable to make a move loses.
Determine who will win if both players play optimally.
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows.
The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of piles of stones.
The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 2 \cdot 10^5$$$) — the number of stones in the piles.
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.
For each test case, output "Alice" (without quotes) if Alice wins and "Bob" (without quotes) otherwise.
You can output each letter in any case (upper or lower). For example, the strings "alIcE", "Alice", and "alice" will all be considered identical.
422 133 5 744 6 8 1058 8 8 8 8
Bob Alice Alice Bob
In the first test case, there are $$$2$$$ piles of stones with $$$2$$$ and $$$1$$$ stones respectively. Since neither $$$1$$$ nor $$$2$$$ can be split into two prime numbers, Alice cannot make a move, so Bob wins.
In the second test case, there are $$$3$$$ piles of stones with $$$3$$$, $$$5$$$, and $$$7$$$ stones respectively. Alice can choose $$$k = 1$$$, remove the pile of $$$7$$$ stones, and then split the pile of $$$5$$$ stones into two piles of prime numbers of stones, $$$2$$$ and $$$3$$$. Then, the piles consist of $$$3$$$ piles of stones with $$$3$$$, $$$2$$$, and $$$3$$$ stones respectively, leaving Bob with no valid moves, so Alice wins.
In the third test case, there are $$$4$$$ piles of stones with $$$4$$$, $$$6$$$, $$$8$$$, and $$$10$$$ stones respectively. Alice can choose $$$k = 2$$$, removing two piles of $$$8$$$ and $$$10$$$ stones. She splits the pile of $$$4$$$ stones into two piles of prime numbers of stones, $$$2$$$ and $$$2$$$, and the pile of $$$6$$$ stones into two piles of $$$3$$$ and $$$3$$$ stones. Then, Bob has no valid moves, so Alice wins.
In the fourth test case, there are $$$5$$$ piles of stones, each containing $$$8$$$ stones. It can be shown that if both players play optimally, Bob will win.
Name |
---|