AtCoder Regular Contest 218
B
全减
All Minus
AtCoder
⌀ 1321
原题
← AC →

全减AI (CI翻译)

Problem Statement

题目描述

AI (CI翻译)

There are $N$ non-negative integers $A_1,A_2,\dots,A_N$ written on a blackboard.

黑板上写有 $N$ 个非负整数 $A_1,A_2,\dots,A_N$。AI (CI翻译)

Alice and Bob play a game. Starting with Alice, they alternately perform the following operation, and the player who reduces the number of integers written on the blackboard to $0$ wins.

Alice 和 Bob 进行如下游戏。由 Alice 先手,两人轮流执行以下操作,将黑板上写有的整数个数减少到 $0$ 的玩家获胜。AI (CI翻译)

  • Let $m$ be the minimum non-negative integer currently written on the blackboard.
  • If $m > 0$, choose a positive integer $x$ between $1$ and $m$, inclusive. Replace every integer written on the blackboard with its current value minus $x$.
    • If $m = 0$, erase one or more of the $0$s written on the blackboard.
  • 令 $m$ 为当前黑板上写有的非负整数中的最小值。
  • 如果 $m > 0$,选择一个 $1$ 到 $m$(含)之间的正整数 $x$。将黑板上写有的每个整数都替换为其当前值减去 $x$。
    • 如果 $m = 0$,擦除黑板上写有的一个或多个 $0$。
AI (CI翻译)

Determine who wins when both players play optimally to win.

假设双方都采取最优策略以争取获胜,判断最终谁会获胜。AI (CI翻译)

$T$ test cases are given; solve each of them.

给出 $T$ 个测试用例,请分别求解。AI (CI翻译)

Constraints

约束条件

AI (CI翻译)
  • $1 \le T \le 2 \times 10^5$
  • $1 \le N \le 2 \times 10^5$
  • $0 \le A_i \le 10^9$
  • The sum of $N$ over all test cases is at most $2 \times 10^5$.
  • All input values are integers.
  • $1 \le T \le 2 \times 10^5$
  • $1 \le N \le 2 \times 10^5$
  • $0 \le A_i \le 10^9$
  • 所有测试用例中的 $N$ 之和不超过 $2 \times 10^5$。
  • 所有输入值均为整数。
AI (CI翻译)

Input

输入格式

AI (CI翻译)

The input is given from Standard Input in the following format:

输入从标准输入给出,格式如下:AI (CI翻译)

T
\mathrm{case}_1
\mathrm{case}_2
\vdots
\mathrm{case}_T

T
\mathrm{case}_1
\mathrm{case}_2
\vdots
\mathrm{case}_T
AI (CI翻译)

Each test case is given in the following format:

每个测试用例的格式如下:AI (CI翻译)

N
A_1 A_2 \dots A_N

N
A_1 A_2 \dots A_N
AI (CI翻译)

Output

输出格式

AI (CI翻译)

Output $T$ lines. The $i$-th line should contain Alice if Alice wins in $\mathrm{case}_i$, or Bob if Bob wins.

输出 $T$ 行。第 $i$ 行如果 Alice 在 $\mathrm{case}_i$ 中获胜,则输出 Alice;否则输出 Bob。AI (CI翻译)

样例

Input #1
5
1
2
3
1 1 1
4
1 2 3 4
7
3 1 4 1 5 9 2
3
218 503 2026
Output #1
Alice
Bob
Bob
Bob
Alice
For the first test case, one possible game progression is as follows: - Initially, $2$ is written on the blackboard. - Alice chooses $x = 1$. Now $1$ is written on the blackboard. - Bob chooses $x = 1$. Now $0$ is written on the blackboard. - Alice chooses and erases one $0$. Now nothing is written on the blackboard. When both players play optimally to win, Alice wins. For the second test case, one possible game progression is as follows: - Initially, $1,1,1$ are written on the blackboard. - Alice chooses $x = 1$. Now $0,0,0$ are written on the blackboard. - Bob chooses and erases one $0$. Now $0,0$ are written on the blackboard. - Alice chooses and erases one $0$. Now $0$ is written on the blackboard. - Bob chooses and erases one $0$. Now nothing is written on the blackboard. When both players play optimally to win, Bob wins.
题目信息
题号
arc218_b
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。