QOJ.ac

QOJ

时间限制: 2 s 内存限制: 512 MB 总分: 100

#835. 轻松获胜

统计

Alice 和 Bob 正在玩一个游戏。

他们有 $n$ 堆石子,其中第 $i$ 堆有 $a_i$ ($1 \le a_i \le n$) 个石子。

在每一轮中,玩家(从 Alice 开始)可以选择任意一堆石子,并从中取走至少 1 个、至多 $x$ 个石子。

无法进行操作的玩家(即所有石子堆均为空)输掉游戏。

Alice 和 Bob 尚未决定 $x$ 的最终取值,因此他们请求你找出对于所有 $1 \le x \le n$ 的情况,在双方均采取最优策略时,谁会获胜。

第一行包含一个整数 $n$ ($1 \le n \le 500\,000$):石子堆的数量以及石子数量的上限。

第二行包含 $n$ 个整数 $a_1, a_2, \dots, a_n$ ($1 \le a_i \le n$):各堆石子的数量。

输出 $n$ 个单词,其中第 $i$ 个单词表示当 $x = i$ 时,若双方采取最优策略,Alice 获胜则输出 “Alice”,否则输出 “Bob”。

样例

样例输入 1

6
6 6 6 6 6 6

样例输出 1

Bob Bob Bob Bob Bob Bob

说明

在第一个样例中,无论 $x$ 取何值,Bob 都可以采取对称策略(在拥有相同数量石子的堆上进行相同的操作),因此在每一轮中,他一定至少有一个可行的操作。

样例输入 2

4
1 2 3 4

样例输出 2

Bob Alice Bob Alice

样例输入 3

5
1 2 3 2 2

样例输出 3

Bob Alice Bob Bob Bob

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.