CF1747C.Swap Game

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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

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

  • If a1=0a_1 = 0 , the player loses the game, otherwise:
  • Player chooses some ii with 2in2\le i \le n . Then player decreases the value of a1a_1 by 11 and swaps a1a_1 with aia_i .

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

输入格式

The input consists of multiple test cases. The first line contains a single integer tt (1t2104)(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 nn (2n105)(2 \leq n \leq 10^5) — the length of the array aa .

The second line of each test case contains nn integers a1,a2ana_1,a_2 \ldots a_n (1ai109)(1 \leq a_i \leq 10^9) — the elements of the array aa .

It is guaranteed that sum of nn over all test cases does not exceed 21052 \cdot 10^5 .

输出格式

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.

输入输出样例

  • 输入#1

    3
    2
    1 1
    2
    2 1
    3
    5 4 4

    输出#1

    Bob
    Alice
    Alice

说明/提示

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

In the second testcase, once again, players can only choose i=2i = 2 . Then the array will change as follows: [2,1][1,1][1,0][0,0][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.

首页