knightnemo commited on
Commit
c880053
·
verified ·
1 Parent(s): 502e8c3

Upload code_segments/segment_150.txt with huggingface_hub

Browse files
Files changed (1) hide show
  1. code_segments/segment_150.txt +27 -0
code_segments/segment_150.txt ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 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.
2
+
3
+ On each move, the player does the following three-step process:
4
+
5
+ 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.
6
+
7
+ The player who is unable to make a move loses.
8
+
9
+ Determine who will win if both players play optimally.
10
+
11
+ 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.
12
+
13
+ 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.
14
+
15
+ 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.
16
+
17
+ It is guaranteed that the sum of $n$ over all test cases does not exceed $2 \cdot 10^5$.
18
+
19
+ For each test case, output "Alice" (without quotes) if Alice wins and "Bob" (without quotes) otherwise.
20
+
21
+ You can output each letter in any case (upper or lower). For example, the strings "alIcE", "Alice", and "alice" will all be considered identical.
22
+
23
+ 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.
24
+
25
+ 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.
26
+
27
+ In the third test case, there are $4$ piles