AT_arc229_d.Nim_k ?

提高+/省选-

通过率:0%

时间限制:2.00s

内存限制:1024MB

AC君温馨提醒

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

题目描述

There are K+1K+1 piles of stones. The ii-th pile has AiA_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 KK times.

  • 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 KK times on their own turn loses the game. Which player wins when both players play optimally?

You are given TT test cases; solve each of them.

共有 K+1K+1 堆石子。第 ii 堆有 AiA_i 颗石子。
Alice 和 Bob 进行一场游戏,两人轮流行动,Alice 先手。在每一轮中,必须恰好执行 KK 次以下操作:

  • 选择一堆至少含有一颗石子的石子堆,并从中移除一颗或更多石子。注意:在同一轮中,可以多次选择同一堆石子。

若某位玩家在其回合内无法完成 KK 次操作,则该玩家输掉游戏。当双方均采取最优策略时,谁将获胜?

你将得到 TT 组测试数据,请对每一组求解。

输入格式

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

TT
case1\mathrm{case}_1
case2\mathrm{case}_2
⋮\vdots
caseT\mathrm{case}_T

Each test case caset\mathrm{case}_t is given in the following format:

KK
A1A_1 A2A_2 …\dots AK+1A_{K+1}

输入从标准输入中按以下格式给出:

TT
case1\mathrm{case}_1
case2\mathrm{case}_2
⋮\vdots
caseT\mathrm{case}_T

每个测试用例 caset\mathrm{case}_t 按以下格式给出:

KK
A1A_1 A2A_2 …\dots AK+1A_{K+1}

输出格式

Output TT lines. The ii-th line should contain Alice if Alice wins when both players play optimally for the ii-th test case, and Bob if Bob wins.

输出 TT 行。第 ii 行应包含 Alice(若在第 ii 个测试用例中双方均采取最优策略时 Alice 获胜),或 Bob(若 Bob 获胜)。

输入输出样例

  • 输入#1

    3
    2
    1 2 3
    1
    4 4
    9
    1 2 3 4 5 6 7 8 9 10

    输出#1

    Alice
    Bob
    Alice

说明/提示

Sample 1 Explanation:
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 00.
  • Choose the third pile, and remove three stones from it. The number of stones in the third pile becomes 00.

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.

Constraints

  • 1≤T≤2×1051 \leq T \leq 2 \times 10^5
  • 1≤K≤2×1051 \leq K \leq 2 \times 10^5
  • 1≤Ai≤1091 \leq A_i \leq 10^9
  • The sum of KK over all test cases is at most 2×1052 \times 10^5.
  • All input values are integers.

样例 1 解释:
考虑第一个测试用例。
例如,假设爱丽丝在她的第一回合执行以下操作:

  • 选择第二堆石子,并从中移除两颗石子。第二堆石子的数量变为 00。
  • 选择第三堆石子,并从中移除三颗石子。第三堆石子的数量变为 00。

在她这一回合结束后,仅剩一颗石子。因此,鲍勃无法执行两次操作,爱丽丝获胜。

在第二个测试用例中,每当爱丽丝从某一堆石子中移除若干颗石子时,鲍勃总能从另一堆石子中移除相同数量的石子。通过采取这种方式,鲍勃可以获胜。

约束条件

  • 1≤T≤2×1051 \leq T \leq 2 \times 10^5
  • 1≤K≤2×1051 \leq K \leq 2 \times 10^5
  • 1≤Ai≤1091 \leq A_i \leq 10^9
  • 所有测试用例中 KK 的总和不超过 2×1052 \times 10^5。
  • 所有输入值均为整数。

输入解题思路,AI测评打分。不知道怎么写?

首页