Codeforces Round 832 (Div. 2)
C
Swap Game
Codeforces
1200
原题
← BD →
翻译中…

Alice and Bob are playing a game on an array $a$ of $n$ positive integers. Alice and Bob make alternating moves with Alice going first.

翻译中…

In his/her turn, the player makes the following move:

翻译中…
  • If $a_1 = 0$, the player loses the game, otherwise:
  • Player chooses some $i$ with $2\le i \le n$. Then player decreases the value of $a_1$ by $1$ and swaps $a_1$ with $a_i$.
翻译中…

Determine the winner of the game if both players play optimally.

翻译中…

Input

翻译中…

The input consists of multiple test cases. The first line contains a single integer $t$ $(1 \leq t \leq 2 \cdot 10^4)$  — the number of test cases. The description of the test cases follows.

翻译中…

The first line of each test case contains a single integer $n$ $(2 \leq n \leq 10^5)$  — the length of the array $a$.

翻译中…

The second line of each test case contains $n$ integers $a_1,a_2 \ldots a_n$ $(1 \leq a_i \leq 10^9)$  — the elements of the array $a$.

翻译中…

It is guaranteed that sum of $n$ over all test cases does not exceed $2 \cdot 10^5$.

翻译中…

Output

翻译中…

For each test case, if Alice will win the game, output "Alice". Otherwise, output "Bob".

翻译中…

You can output each letter in any case. For example, "alIcE", "Alice", "alice" will all be considered identical.

翻译中…

Note

翻译中…

In the first testcase, in her turn, Alice can only choose $i = 2$, making the array equal $[1, 0]$. Then Bob, in his turn, will also choose $i = 2$ and make the array equal $[0, 0]$. As $a_1 = 0$, Alice loses.

翻译中…

In the second testcase, once again, players can only choose $i = 2$. Then the array will change as follows: $[2, 1] \to [1, 1] \to [1, 0] \to [0, 0]$, and Bob loses.

翻译中…

In the third testcase, we can show that Alice has a winning strategy.

翻译中…

样例

Input #1
3
2
1 1
2
2 1
3
5 4 4
Output #1
Bob
Alice
Alice
InputCopy OutputCopy
题目信息
题号
1747C
时间限制
1 s
内存限制
256 MB
标签
博弈论

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