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$。

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

About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.