全减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.
- If
- 令
$m$为当前黑板上写有的非负整数中的最小值。 - 如果
$m > 0$,选择一个$1$到$m$(含)之间的正整数$x$。将黑板上写有的每个整数都替换为其当前值减去$x$。- 如果
$m = 0$,擦除黑板上写有的一个或多个$0$。
- 如果
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$。 - 所有输入值均为整数。
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}_TAI (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_NAI (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翻译)
样例
5
1
2
3
1 1 1
4
1 2 3 4
7
3 1 4 1 5 9 2
3
218 503 2026
Alice
Bob
Bob
Bob
Alice
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。