Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

4/2/24, 9:01 AM Problem - 1659A - Codeforces

|
riteshnub | Logout
You have +385! Wow!

HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP

PROBLEMS SUBMIT STATUS STANDINGS CUSTOM TEST

00:00:06

Codeforces Round 782 (Div. 2)


Finished
A. Red Versus Blue
time limit per test: 1 second Practice
memory limit per test: 256 megabytes
input: standard input
output: standard output
→ Virtual participation 
Team Red and Team Blue competed in a competitive FPS. Their match was streamed around
Virtual contest is a way to take part in past
the world. They played a series of n matches. contest, as close as possible to participation
on time. It is supported only ICPC mode for
In the end, it turned out Team Red won r times and Team Blue won b times. Team Blue was virtual contests. If you've seen these
problems, a virtual contest is not for you -
less skilled than Team Red, so b was strictly less than r . solve these problems in the archive. If you
just want to solve some problem from a
You missed the stream since you overslept, but you think that the match must have been neck contest, a virtual contest is not for you -
solve this problem in the archive. Never use
and neck since so many people watched it. So you imagine a string of length n where the i -th someone else's code, read the tutorials or
character denotes who won the i -th match — it is R if Team Red won or B if Team Blue won. communicate with other person during a
virtual contest.
You imagine the string was such that the maximum number of times a team won in a row
was as small as possible. For example, in the series of matches RBBRRRB, Team Red won Start virtual contest
3 times in a row, which is the maximum.

You must find a string satisfying the above conditions. If there are multiple answers, print any. → Clone Contest to Mashup 
Input You can clone this contest to a mashup.
The first line contains a single integer t (1 ≤ t ≤ 1000) — the number of test cases.
Clone Contest
Each test case has a single line containing three integers n, r , and b (3 ≤ n ≤ 100 ;
1 ≤ b < r ≤ n , r + b = n).

→ Submit?
Output
For each test case, output a single line containing a string satisfying the given conditions. If
Language: GNU G++17 7.3.0
there are multiple answers, print any.
Choose
Choose File No file chosen
Examples file:

input Copy Submit

3
7 4 3
6 5 1
19 13 6
→ Problem tags

output Copy constructive algorithms greedy

RBRBRBR implementation math *1000


RRRBRR No tag edit access
RRBRRBRRBRRBRRBRRBR

input Copy → Contest materials

6
Announcement (en)
3 2 1
10 6 4 Tutorial (en)
11 6 5
10 9 1
10 8 2
11 9 2

output Copy

RBR
RRBRBRBRBR
RBRBRBRBRBR
RRRRRBRRRR
RRRBRRRBRR
RRRBRRRBRRR

https://codeforces.com/problemset/problem/1659/A 1/2
4/2/24, 9:01 AM Problem - 1659A - Codeforces
Note
The first test case of the first example gives the optimal answer for the example in the
statement. The maximum number of times a team wins in a row in RBRBRBR is 1. We cannot
minimize it any further.

The answer for the second test case of the second example is RRBRBRBRBR. The maximum
number of times a team wins in a row is 2, given by RR at the beginning. We cannot minimize
the answer any further.

Codeforces (c) Copyright 2010-2024 Mike Mirzayanov


The only programming contests Web 2.0 platform
Server time: Apr/02/2024 09:00:28UTC+5.5 (f1).
Desktop version, switch to mobile version.
Privacy Policy

Supported by

https://codeforces.com/problemset/problem/1659/A 2/2

You might also like