codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

1659A.md (2129B)


      1 Source: https://codeforces.com/problemset/problem/1659/A
      2 
      3 A. Red Versus Blue
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 Team Red and Team Blue competed in a competitive FPS. Their match was streamed around the world. They played a series of $n$ matches.
     22 
     23 In the end, it turned out Team Red won $r$ times and Team Blue won $b$ times. Team Blue was less skilled than Team Red, so $b$ was strictly less than $r$.
     24 
     25 You missed the stream since you overslept, but you think that the match must have been neck and neck since so many people watched it. So you imagine a string of length $n$ where the $i$-th character denotes who won the $i$-th match  — it is R if Team Red won or B if Team Blue won. 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 $3$ times in a row, which is the maximum.
     26 
     27 You must find a string satisfying the above conditions. If there are multiple answers, print any.
     28 
     29 Input
     30 
     31 The first line contains a single integer $t$ ($1 \le t \le 1000$)  — the number of test cases.
     32 
     33 Each test case has a single line containing three integers $n$, $r$, and $b$ ($3 \leq n \leq 100$; $1 \leq b \lt r \leq n$, $r+b=n$).
     34 
     35 Output
     36 
     37 For each test case, output a single line containing a string satisfying the given conditions. If there are multiple answers, print any.
     38 
     39 Examples
     40 
     41 Input
     42 
     43 ```
     44 3
     45 
     46 7 4 3
     47 
     48 6 5 1
     49 
     50 19 13 6
     51 ```
     52 
     53 Output
     54 
     55 ```
     56 RBRBRBR
     57 RRRBRR
     58 RRBRRBRRBRRBRRBRRBR
     59 ```
     60 
     61 Input
     62 
     63 ```
     64 6
     65 
     66 3 2 1
     67 
     68 10 6 4
     69 
     70 11 6 5
     71 
     72 10 9 1
     73 
     74 10 8 2
     75 
     76 11 9 2
     77 ```
     78 
     79 Output
     80 
     81 ```
     82 RBR
     83 RRBRBRBRBR
     84 RBRBRBRBRBR
     85 RRRRRBRRRR
     86 RRRBRRRBRR
     87 RRRBRRRBRRR
     88 ```
     89 
     90 Note
     91 
     92 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.
     93 
     94 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.