CF2200E.Divisive Battle

普及/提高-

通过率:0%

时间限制:3.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

Alice and Bob are playing game on array aa initially containing nn positive integers, with Alice going first.

On each player's turn, if aa is non-decreasing∗^{\text{∗}}, the game immediately ends. Otherwise, the player can choose an element xx from the array and positive integers 1<y,z<x1 \lt y,z \lt x such that x=yzx=yz and replace xx in the array with two elements yy and zz (in any order at the original location of xx). If no such move is possible, the game ends.

Once the game ends, if aa is non-decreasing, then Bob wins. Otherwise, Alice wins. Determine who will win the game if both players play optimally.

∗^{\text{∗}}aa is non-decreasing if ai≤ai+1a_i\leq a_{i+1} for all 1≤i≤m−11\leq i\leq m-1, where mm is the length of aa.

Alice 和 Bob 正在对一个初始包含 nn 个正整数的数组 aa 进行博弈,Alice 先手。

在每位玩家的回合中,若 aa 是非递减的∗^{\text{∗}},则游戏立即结束。否则,该玩家可从数组中选择一个元素 xx,并选择满足 1<y,z<x1 \lt y,z \lt x 的正整数 y,zy, z,使得 x=yzx = yz,然后将 xx 替换为两个元素 yy 和 zz(以任意顺序置于原 xx 的位置)。若不存在这样的操作,则游戏结束。

游戏结束后,若 aa 是非递减的,则 Bob 获胜;否则 Alice 获胜。假设双方均采取最优策略,请判断谁将获胜。

∗^{\text{∗}} 数组 aa 是非递减的,当且仅当对所有 1≤i≤m−11 \leq i \leq m-1 均有 ai≤ai+1a_i \leq a_{i+1},其中 mm 为 aa 的长度。

输入格式

The first line contains an integer tt (1≤t≤1041 \leq t \leq 10^4), the number of test cases.

The first line of each test case contains an integer nn (1≤n≤1051 \leq n \leq 10^5).

The second line of each test case contains nn integers a1,a2,…,ana_1, a_2, \dots, a_n (1≤ai≤1061 \leq a_i \leq 10^6).

The sum of nn over all test cases does not exceed 10510^5.

第一行包含一个整数 tt(1≤t≤1041 \leq t \leq 10^4),表示测试用例的数量。

每个测试用例的第一行包含一个整数 nn(1≤n≤1051 \leq n \leq 10^5)。

每个测试用例的第二行包含 nn 个整数 a1,a2,…,ana_1, a_2, \dots, a_n(1≤ai≤1061 \leq a_i \leq 10^6)。

所有测试用例中 nn 的总和不超过 10510^5。

输出格式

For each test case, output a line containing "Alice" if Alice wins or "Bob" if Bob wins. The grader is case-sensitive.

对于每个测试用例,如果 Alice 获胜则输出一行 “Alice”,如果 Bob 获胜则输出一行 “Bob”。评测系统区分大小写。

输入输出样例

  • 输入#1

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

    输出#1

    Alice
    Bob
    Alice
    Bob

说明/提示

In the first test case, Alice will win if both players play optimally.

In the second test case, Bob can always win no matter what moves Alice makes.

In the third test case, Alice can win by replacing 66 with 33 and 22.

In the fourth test case, the game ends immediately and Bob wins.

在第一个测试用例中,若双方均采取最优策略,则爱丽丝获胜。

在第二个测试用例中,无论爱丽丝如何行动,鲍勃总能获胜。

在第三个测试用例中,爱丽丝可通过将 66 替换为 33 和 22 来获胜。

在第四个测试用例中,游戏立即结束,鲍勃获胜。

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

首页