QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 512 MB Total points: 100

#835. 輕鬆獲勝

Statistics

Alice 和 Bob 正在玩一個遊戲。 他們有 $n$ 堆石頭,其中第 $i$ 堆有 $a_i$ ($1 \le a_i \le n$) 個石頭。 在各自的回合中,每位玩家(由 Alice 先手)會選擇任意一堆石頭,並從中拿走至少一個、最多 $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

範例輸入 2

4
1 2 3 4

範例輸出 2

Bob Alice Bob Alice

範例輸入 3

5
1 2 3 2 2

範例輸出 3

Bob Alice Bob Bob Bob

說明

在第一個範例中,無論 $x$ 為何,Bob 都可以採取對稱策略(在與 Alice 選擇的石頭數量相同的堆上進行相同的操作),因此在每一回合中,他一定至少有一個可行的操作。

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.