QOJ.ac

QOJ

Time Limit: 1.0 s Memory Limit: 256 MB Total points: 100 Hackable ✓

#9081. 取石子游戏

Statistics

Alice 和 Bob 又在玩游戏了!今天的游戏是轮流从石堆中取走石头。

现有 $n$ 堆石头,第 $i$ 堆包含 $A[i]$ 个石头。

由于每一堆石头的数量都与其相邻堆的数量不同,他们决定在每一回合中,从其中一堆里恰好取走一个石头,且不能破坏这一性质。Alice 先手。

无法取走石头的玩家将输掉游戏。

现在给定代表各堆石头数量的 $n$ 个数,假设两人都采取最优策略,请你确定获胜者。

注意,即使是 0 个石头的堆也被视为一堆!

输入格式

输入文件的第一行包含一个整数 $T$ ($1 \le T \le 100$),表示测试用例的数量。

接下来有 $2 \times T$ 行,每两行代表一个测试用例。

每个测试用例的第一行包含一个整数 $n$ ($1 \le n \le 10^5$),含义如上所述。

每个测试用例的第二行包含 $n$ 个整数,按顺序表示每一堆石头的数量。所有这些数字的范围都在 $[0, 10^9]$ 内。

保证所有测试用例中 $n$ 的总和不超过 $10^6$。

输出格式

你需要输出恰好 $T$ 行。

对于每个测试用例,首先打印 Case d:($d$ 表示测试用例的序号),然后打印获胜者的名字,即 AliceBob

样例

输入 1

2
2
1 3
3
1 3 1

输出 1

Case 1: Alice
Case 2: Bob

说明

样例 1:

一种可能的取石序列为:$(1, 3) \to (1, 2) \to (0, 2) \to (0, 1)$

以下是一个无效序列:$(1, 3) \to (1, 2) \to (1, 1) \to (0, 1)$。虽然它与第一个序列的结果相同,但它破坏了“每一堆石头的数量都与其相邻堆的数量不同”这一性质。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.