Pinely Round 4 (Div. 1 + Div. 2)
H
Prime Split Game
Codeforces
3300
原题
← GI →
翻译中…

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:

翻译中…
  1. Choose an integer $k$ ($1 \leq k \leq \frac n 2$). Note that the value of $k$ can be different for different moves.
  2. Remove $k$ piles of stones.
  3. Choose another $k$ piles of stones and split each pile into two piles. The number of stones in each new pile must be a prime number.
翻译中…

The player who is unable to make a move loses.

翻译中…

Determine who will win if both players play optimally.

翻译中…

Input

翻译中…

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$.

翻译中…

Output

翻译中…

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.

翻译中…

Note

翻译中…

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.

翻译中…

样例

Input #1
4
2
2 1
3
3 5 7
4
4 6 8 10
5
8 8 8 8 8
Output #1
Bob
Alice
Alice
Bob
InputCopy OutputCopy
题目信息
题号
1991H
时间限制
2 s
内存限制
256 MB
标签
位运算
动态规划
FFT
博弈论
数学
数论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。