QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 1024 MB Total points: 100

#8224. Caught in the Middle

الإحصائيات

给定一个长度为 $n$ 的仅包含 '$\texttt{L}$','$\texttt{R}$' 的字符串 $s$. Alice, Bob 打算使用字符串进行一次游戏。

Alice 和 Bob 会轮流对字符串 $s$ 进行操作,Alice 先手。

每次操作时,假定当前剩余字符串为 $s$。如果 $s$ 为空串,则此时操作者输掉游戏。否则操作者可以从 $\{1,2,\cdots,|s|\}$ 中选择整数 $i$。 如果 $s_i = \texttt{'L'}$,则操作后剩余字符串为 $s_{1}s_{2}\cdots s_{i-1}$;如果 $s_i = \texttt{'R'}$,则操作后剩余字符串为 $s_{i+1}s_{i+2}\cdots s_{|s|}$。

两个人都绝顶聪明,因此他们都总会采用最优的策略。而你,一个参加 PKUWC 的普通吃瓜群众,想要知道这场游戏的胜者。

输入格式

第一行一个正整数 $T$, 表示数据组数。

对于每一组测试数据:

第一行一个正整数 $n$。

第二行一个长度为 $n$ 的仅包含 '$\texttt{L}$','$\texttt{R}$' 的字符串 $s$,表示游戏初始字符串。

输出格式

对于每组测试数据,输出一行 AliceBob, 表示游戏胜者。

样例数据

样例输入

3
5
LRLLR
6
RLRLRL
1
L

样例输出

Alice
Bob
Alice

子任务

Subtask 1 (23 pts): $n\le 10, T\le 20$

Subtask 2 (22 pts): $\sum n\le 500$

Subtask 3 (28 pts): $\sum n\le 5000$

Subtask 4 (27 pts): $\sum n\le 10^6$

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.