QOJ.ac

QOJ

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

#13065. 字符串游戏

統計

最近 Alice 和 Bob 在玩一个和字符串有关的游戏。在游戏开始之前,他们会准备 $n$ 个字符串 $s_1, s_2 \ldots s_n$ 和一个模板串 $t$, 保证这 $n$ 个字符串都是 $t$ 的子串。

游戏开始后,他们会轮流地执行以下操作,由 Alice 先手。

  • 从 $n$ 个字符串中选择一个字符串 $s_i$;
  • 在 $s_i$ 末尾增加一个字符;
  • 得到的新字符串需要是 $t$ 的子串;

如果上述过程无法完成,当前玩家失败,假设 Alice 和 Bob 都以最优策略行动,求出谁是游戏的胜者。

输入格式

输入包含多组测试数据。

每组数据以一个非空模板串 $t$ 开始。

第二行包含一个整数 $n$,表示他们准备的字符串数量,接下来的 $n$ 行,每行一个字符串 $s_i$, 输入保证所有字符串都是 $t$ 的子串。

输出格式

对于每组测试数据,输出胜利者的姓名 Alice 或 Bob。

样例数据

样例输入

aaaa
1
a
abcabd
1
a

样例输出

Alice
Bob

限制

$|t|\le 10^5, n\le 100$, 输入所有字符串的总长不超过 $3 \times 10^7$。

特别鸣谢楼天城和吉如一提供试题,数据。

Discussions

About Discussions

The discussion section is only for posting: Editorials, 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. Submitting multiple issues may cause your account to be banned.
  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.