#P10398. 『STA - R5』Remove and Decrease Game
『STA - R5』Remove and Decrease Game
Problem Description
You are given piles of stones. The -th pile contains stones, and it is guaranteed that are all distinct.
Alice and Bob take turns performing one of the following two operations, and after the operation they remove any pile whose number of stones becomes . Alice moves first. The player who cannot make a move loses.
- Take one stone from every pile.
- Remove the pile with the smallest number of stones.
Assuming both players play optimally, determine who will win. You need to answer queries.
Input Format
This problem contains multiple queries in a single test case.
The first line contains a positive integer , the number of queries.
For each query: the first line contains a positive integer , the number of piles. The second line contains positive integers, where the -th integer represents .
Output Format
For each query, output one line containing Alice or Bob, indicating who will win.
3
1
7
3
6 7 3
4
2 8 5 6
Alice
Bob
Alice
Hint
This problem uses bundled tests.
For of the testdata:
- ;
- ;
- ;
- are pairwise distinct;
- 。
The detailed subtask distribution is as follows:
| Subtask ID | Constraints | Score |
|---|---|---|
| 1 | ||
| 2 | , | |
| 3 | ||
| 4 | ||
| 5 | No special constraints |
Translated by ChatGPT 5