GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Sunday 31 July 2022

[Solution] Colouring Game Codeforces Solution


F. Colouring Game
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

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

Solution Click Below:-  👉CLICK HERE👈

👇👇👇👇👇

 other cell satisfies the constraints.

Input

The first line contains a single integer t (1t104) — the number of test cases. Description of test cases follows.

For each test case, the first line contains an integer n (2n5105) — 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 si= R, blue if si= B.

It is guaranteed that the sum of n over all test cases does not exceed 5105.

Output

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

No comments:

Post a Comment