QOJ.ac

QOJ

حد الوقت: 1.0 s حد الذاكرة: 512 MB مجموع النقاط: 100 قابلة للهجوم ✓

#12333. 长对局

الإحصائيات

Alice 和 Bob 在一个包含 $n$ 个整数的排列 $p = (p_1, p_2, \dots, p_n)$($1$ 到 $n$ 的排列)上玩一个长游戏。该排列写在一条纸带上。Alice 先手,随后两人轮流操作。无法进行操作的玩家输掉游戏。

在第 $i$ 次操作中,玩家选择当前存在的 $i$ 条纸带中的一条,设其长度为 $m \ge 2$。然后,玩家选择一个整数 $k$ ($1 \le k < m$),并将选中的纸带切成两条长度分别为 $k$ 和 $m - k$ 的新纸带。这里 $k$ 表示原纸带中成为第一部分最后一个元素的索引,因此第 $k+1$ 个元素成为第二部分的开头。但切分必须满足以下条件:切分后,所有剩余的纸带中,至少要有一条纸带包含至少一个逆序对(即存在索引 $i, j$ 满足 $i < j$ 且 $p_i > p_j$)。如果不满足此条件,则该操作被视为非法,不能进行。

注意,新形成的纸带中元素的顺序不会改变,玩家不允许反转或交换任何纸带中的元素。

给定一个 $n$ 个整数的排列 $p$,若双方都采取最优策略,确定谁会获胜。

输入格式

第一行包含一个整数 $n$ ($2 \le n \le 10^5$),表示排列的长度。 第二行包含 $n$ 个空格分隔的整数 $p_1, p_2, \dots, p_n$ ($1 \le p_i \le n$,所有 $p_i$ 互不相同):即排列本身。

输出格式

如果先手获胜,输出单词 “Alice”,否则输出 “Bob”。

样例

输入 1

5
3 4 1 2 5

输出 1

Alice

输入 2

7
1 2 3 4 5 6 7

输出 2

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.