[Solution] Colouring Game Codeforces Solution
Alice and Bob are playing a game. There are 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.
The first line contains a single integer () — the number of test cases. Description of test cases follows.
For each test case, the first line contains an integer () — the number of cells.
The second line contains a string of length — the initial state of the cells. The -th cell is red if R, blue if B.
It is guaranteed that the sum of over all test cases does not exceed .
For each test case, output the name of the winner on a separate line.
No comments:
Post a Comment