第 229 场 AtCoder Regular Contest
D
Nim_k?
Nim_k ?
AtCoder
⌀ 1890
原题
← CE →

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.
  • 选择一堆仍有一颗或更多石子的石子堆,并从中取走一颗或更多石子。注意,在同一个回合内可以多次选择同一堆石子。
AI (CI翻译)

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$。
  • 所有输入值均为整数。
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 $\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翻译)

样例

Input #1
3
2
1 2 3
1
4 4
9
1 2 3 4 5 6 7 8 9 10
Output #1
Alice
Bob
Alice
Consider the first test case. For example, suppose Alice performs the following operations on her first turn. - Choose the second pile, and remove two stones from it. The number of stones in the second pile becomes $0$. - Choose the third pile, and remove three stones from it. The number of stones in the third pile becomes $0$. After her turn ends, only one stone remains. Therefore, Bob cannot perform the operation twice, so Alice wins. In the second test case, every time Alice removes stones from one pile, Bob can remove the same number of stones from the other pile. By acting in this way, Bob can win.
题目信息
题号
arc229_d
时间限制
2 s
内存限制
1024 MB

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