QOJ.ac

QOJ

时间限制: 1 s 内存限制: 256 MB 总分: 100

#1644. 翻转游戏

统计

Alice 和 Bob 正在玩一个回合制游戏。游戏规则如下:

  1. 游戏开始时,会选定一个二进制字符串 $s$。

  2. 在每一回合中,玩家必须选择 $s$ 的一个子串 $t$,且 $t$ 必须等于 101101001010 中的某一个。然后,玩家将 $t$ 反转。例如,如果 $s = 010101$,玩家可以选择子串 $t = 1010$ 并将其反转,得到 $s = 001011$。

  3. 无法进行操作的玩家(即无法选择合适的子串 $t$ 的玩家)输掉游戏。

  4. 玩家不能跳过回合。

如果 Alice 先手,哪位玩家拥有必胜策略?

如果字符串 $a$ 可以通过从字符串 $b$ 的开头删除若干(可能为零或全部)字符,并从结尾删除若干(可能为零或全部)字符得到,则称 $a$ 是 $b$ 的子串。

输入格式

输入仅一行,包含一个二进制字符串 $s$ ($1 \le |s| \le 10^6$),即 Alice 和 Bob 玩游戏时所用的字符串。

输出格式

如果 Alice 获胜,输出 Alice。否则,输出 Bob

样例

输入格式 1

010

输出格式 1

Alice

说明

在第一个样例中,Alice 可以选择 010 中的子串 10 并将其反转,得到字符串 001。Bob 无法对该字符串进行任何操作,因此输掉游戏。

输入格式 2

1111

输出格式 2

Bob

说明

在第二个样例中,Alice 无法进行任何操作,因此输掉游戏。

输入格式 3

1010

输出格式 3

Bob

输入格式 4

1010001011001

输出格式 4

Alice

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#316EditorialOpen题解jiangly2025-12-14 07:03:28View

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.