QOJ.ac

QOJ

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

#835. 쉬운 승리

Statistics

앨리스와 밥이 게임을 하고 있습니다. 그들은 $n$개의 돌무더기를 가지고 있으며, $i$번째 돌무더기에는 $a_i$ ($1 \le a_i \le n$)개의 돌이 있습니다. 각 플레이어는 앨리스부터 시작하여 자신의 차례가 되면 돌무더기 하나를 골라 최소 1개에서 최대 $x$개까지의 돌을 가져갑니다. 자신의 차례에 돌을 가져갈 수 없는 플레이어(모든 돌무더기가 비어 있는 경우)가 패배합니다. 앨리스와 밥은 아직 최종 $x$ 값을 결정하지 못했기 때문에, $1 \le x \le n$인 모든 $x$에 대해 두 플레이어가 최적으로 게임을 할 때 누가 승리할지 알아내 달라고 요청했습니다.

입력

첫 번째 줄에는 돌무더기의 개수이자 돌무더기에 있는 돌 개수의 상한인 정수 $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"를, 그렇지 않으면 "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$와 관계없이 밥은 대칭적인 수(돌의 개수가 같은 무더기에 똑같은 수를 두는 것)를 둘 수 있으므로, 매 차례마다 반드시 최소한 하나의 가능한 수를 둘 수 있습니다.

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.