Nim_k?AI (CI翻译)
Problem Statement
题目描述
AI (CI翻译)There are $K+1$ piles of stones. The $i$-th pile has $A_i$ stones.
Alice and Bob play a game. In this game, they alternately take turns with Alice moving first. On each turn, the following operation is performed exactly $K$ times.
有 $K+1$ 堆石子。第 $i$ 堆有 $A_i$ 颗石子。
Alice 和 Bob 进行如下游戏。两人轮流行动,由 Alice 先手。每次行动中,必须恰好执行 $K$ 次以下操作。AI (CI翻译)
- Choose a pile with one or more stones, and remove one or more stones from it. Here, the same pile may be chosen multiple times within the same turn.
- 选择一堆仍有一颗或更多石子的石子堆,并从中取走一颗或更多石子。注意,在同一个回合内可以多次选择同一堆石子。
The player who is unable to perform the operation $K$ times on their own turn loses the game. Which player wins when both players play optimally?
如果某位玩家在自己的回合无法完成 $K$ 次操作,则该玩家输掉游戏。当双方都采取最优策略时,获胜者是谁?AI (CI翻译)
You are given $T$ test cases; solve each of them.
给定 $T$ 组测试数据,请分别求出每组测试数据的答案。AI (CI翻译)
Constraints
约束条件
AI (CI翻译)$1 \leq T \leq 2 \times 10^5$$1 \leq K \leq 2 \times 10^5$$1 \leq A_i \leq 10^9$- The sum of
$K$over all test cases is at most$2 \times 10^5$. - All input values are integers.
$1 \leq T \leq 2 \times 10^5$$1 \leq K \leq 2 \times 10^5$$1 \leq A_i \leq 10^9$- 所有测试数据中
$K$的总和不超过$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 $\mathrm{case}_t$ is given in the following format:
每组测试数据 $\mathrm{case}_t$ 按以下格式给出:AI (CI翻译)
K
A_1 A_2 \dots A_{K+1}
K
A_1 A_2 \dots A_{K+1}AI (CI翻译)
Output
输出格式
AI (CI翻译)Output $T$ lines. The $i$-th line should contain Alice if Alice wins when both players play optimally for the $i$-th test case, and Bob if Bob wins.
输出 $T$ 行。第 $i$ 行中,如果对于第 $i$ 组测试数据,在双方都采取最优策略时 Alice 获胜,则输出 Alice;如果 Bob 获胜,则输出 Bob。AI (CI翻译)
样例
3
2
1 2 3
1
4 4
9
1 2 3 4 5 6 7 8 9 10
Alice
Bob
Alice
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。