CodeTON Round 2 (Div. 1 + Div. 2, Rated, Prizes!)
F
Colouring Game
Codeforces
2600
原题
← EG →
翻译中…

Alice and Bob are playing a game. There are $n$ cells in a row. Initially each cell is either red or blue. Alice goes first.

翻译中…

On each turn, Alice chooses two neighbouring cells which contain at least one red cell, and paints that two cells white. Then, Bob chooses two neighbouring cells which contain at least one blue cell, and paints that two cells white. The player who cannot make a move loses.

翻译中…

Find the winner if both Alice and Bob play optimally.

翻译中…

Note that a chosen cell can be white, as long as the other cell satisfies the constraints.

翻译中…

Input

翻译中…

The first line contains a single integer $t$ ($1 \leq t \leq 10^4$) — the number of test cases. Description of test cases follows.

翻译中…

For each test case, the first line contains an integer $n$ ($2 \leq n \leq 5 \cdot 10^5$) — the number of cells.

翻译中…

The second line contains a string $s$ of length $n$ — the initial state of the cells. The $i$-th cell is red if $s_i = $ R, blue if $s_i = $ B.

翻译中…

It is guaranteed that the sum of $n$ over all test cases does not exceed $5 \cdot 10^5$.

翻译中…

Output

翻译中…

For each test case, output the name of the winner on a separate line.

翻译中…

Note

翻译中…

In the notes, the cell numbers increase from left to right.

翻译中…

In the first testcase for Alice, she has two choices: paint the first and the second cells, or paint the second and the third cells. No matter what choice Alice makes, there will be exactly one blue cell after Alice's move. Bob just needs to paint the blue cell and its neighbour, then every cell will be white and Alice can't make a move. So Bob is the winner.

翻译中…

In the second testcase no matter what Alice chooses, Bob can choose to paint the fourth and fifth cells in $2$ turns.

翻译中…

In the third testcase at first, Alice paints the third and the fourth cells. It doesn't matter if Bob paints the first and the second cells or the fifth and sixth cells, as Alice can paint the other two cells.

翻译中…

In the fourth testcase at first, Alice paints the second and the third cells. If Bob paints the fifth and the sixth cells or the fourth and the fifth cells, then Alice paints the seventh and the eighth cells. If Bob paints the seventh and the eighth cells, then Alice paints the fifth and the sixth cells.

翻译中…

In the fifth Alice chooses the middle two cells at first, then Bob obviously has only two options, whichever variant he chooses, Alice can choose the other one and win.

翻译中…

In the eighth no matter what Alice chooses, Bob can choose the other two symmetrical cells.

翻译中…

样例

Input #1
8
3
BRB
5
RRBBB
6
RBRBRB
8
BBRRBRRB
6
BRRBRB
12
RBRBRBRBRRBB
12
RBRBRBRBBBRR
4
RBBR
Output #1
Bob
Bob
Alice
Alice
Alice
Alice
Bob
Bob
InputCopy OutputCopy
题目信息
题号
1704F
时间限制
1 s
内存限制
256 MB
标签
构造
动态规划
博弈论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。