AT_arc218_b.All Minus

普及+/提高

通过率:0%

时间限制:2.00s

内存限制:1024MB

AC君温馨提醒

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

题目描述

There are NN non-negative integers A1,A2,…,ANA_1,A_2,\dots,A_N written on a blackboard.

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 00 wins.

  • Let mm be the minimum non-negative integer currently written on the blackboard.
    • If m>0m > 0, choose a positive integer xx between 11 and mm, inclusive. Replace every integer written on the blackboard with its current value minus xx.
    • If m=0m = 0, erase one or more of the 00s written on the blackboard.

Determine who wins when both players play optimally to win.

TT test cases are given; solve each of them.

黑板上写着 NN 个非负整数 A1,A2,…,ANA_1,A_2,\dots,A_N。

爱丽丝(Alice)和鲍勃(Bob)进行一场游戏。游戏由爱丽丝先手,双方轮流执行以下操作;将黑板上的数字个数减至 00 的玩家获胜。

  • 设 mm 为当前黑板上所有数字中最小的非负整数。
    • 若 m>0m > 0,则选择一个介于 11 到 mm(含端点)之间的正整数 xx,并将黑板上每个数字均替换为它当前值减去 xx;
    • 若 m=0m = 0,则擦除黑板上一个或多个 00。

当双方均以最优策略进行游戏时,判断谁将获胜。

共给出 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 is given in the following format:

NN
A1A_1 A2A_2 …\dots ANA_N

输入从标准输入给出,格式如下:

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

每个测试用例的格式如下:

NN
A1A_1 A2A_2 …\dots ANA_N

输出格式

Output TT lines. The ii-th line should contain Alice if Alice wins in casei\mathrm{case}_i, or Bob if Bob wins.

输出 TT 行。第 ii 行应包含 Alice(若 Alice 在 casei\mathrm{case}_i 中获胜)或 Bob(若 Bob 在 casei\mathrm{case}_i 中获胜)。

输入输出样例

  • 输入#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

    输出#1

    Alice
    Bob
    Bob
    Bob
    Alice

说明/提示

Sample 1 Explanation:
For the first test case, one possible game progression is as follows:

  • Initially, 22 is written on the blackboard.
  • Alice chooses x=1x = 1. Now 11 is written on the blackboard.
  • Bob chooses x=1x = 1. Now 00 is written on the blackboard.
  • Alice chooses and erases one 00. 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,11,1,1 are written on the blackboard.
  • Alice chooses x=1x = 1. Now 0,0,00,0,0 are written on the blackboard.
  • Bob chooses and erases one 00. Now 0,00,0 are written on the blackboard.
  • Alice chooses and erases one 00. Now 00 is written on the blackboard.
  • Bob chooses and erases one 00. Now nothing is written on the blackboard.

When both players play optimally to win, Bob wins.

Constraints

  • 1≤T≤2×1051 \le T \le 2 \times 10^5
  • 1≤N≤2×1051 \le N \le 2 \times 10^5
  • 0≤Ai≤1090 \le A_i \le 10^9
  • The sum of NN over all test cases is at most 2×1052 \times 10^5.
  • All input values are integers.

样例 1 解释:
对于第一个测试用例,一种可能的游戏过程如下:

  • 初始时,黑板上写着数字 22。
  • 爱丽丝选择 x=1x = 1,此时黑板上变为 11。
  • 鲍勃选择 x=1x = 1,此时黑板上变为 00。
  • 爱丽丝选择并擦除一个 00,此时黑板上为空。

当双方均以最优策略进行游戏以争取获胜时,爱丽丝获胜。

对于第二个测试用例,一种可能的游戏过程如下:

  • 初始时,黑板上写着 1,1,11,1,1。
  • 爱丽丝选择 x=1x = 1,此时黑板上变为 0,0,00,0,0。
  • 鲍勃选择并擦除一个 00,此时黑板上变为 0,00,0。
  • 爱丽丝选择并擦除一个 00,此时黑板上变为 00。
  • 鲍勃选择并擦除一个 00,此时黑板上为空。

当双方均以最优策略进行游戏以争取获胜时,鲍勃获胜。

约束条件

  • 1≤T≤2×1051 \le T \le 2 \times 10^5
  • 1≤N≤2×1051 \le N \le 2 \times 10^5
  • 0≤Ai≤1090 \le A_i \le 10^9
  • 所有测试用例的 NN 之和不超过 2×1052 \times 10^5。
  • 所有输入值均为整数。

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

首页