Codeforces Round 1087 (Div. 2)
D
Ghostfires
Codeforces
1800
原题
← CE →
翻译中…

OtterZ decided to make a weapon using ghostfires. He collected several ghostfires in colors red, green, and blue. He will put some of the ghostfires in a row to build the weapon. To make the weapon more powerful, OtterZ will use as many ghostfires as possible, but the weapon will be out of control if there are two ghostfires of the same color adjacent or separated by exactly two ghostfires in the row.

翻译中…

Formally, OtterZ collected $r$ red ghostfires, $g$ green ghostfires, and $b$ blue ghostfires. He wants to construct a string $s$ consisting of the characters 'R', 'G', and 'B' that satisfies the following conditions:

翻译中…
  • The number of occurrences of 'R', 'G', and 'B' in $s$ does not exceed $r$, $g$, and $b$, respectively.
  • For all $1 \le i \le |s|-1$, $s_i \ne s_{i+1}$.
  • For all $1 \le i \le |s|-3$, $s_i \ne s_{i+3}$.
  • The length of $s$ is the maximum possible.
翻译中…

Help OtterZ to construct the row. Although there may be several possible rows, OtterZ just requires one of them.

翻译中…

Input

翻译中…

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.

翻译中…

The only line of each test case contains three integers $r$, $g$, and $b$ ($0\le r,g,b \le 10 ^ 6$, $r+g+b \gt 0$), representing the number of red, green, and blue ghostfires, respectively.

翻译中…

It is guaranteed that the sum of $r + g + b$ over all test cases does not exceed $10 ^ 6$.

翻译中…

Output

翻译中…

For each query, output a string $s$ consisting of the characters 'R', 'G', and 'B', where $s_i$ equals 'R', 'G' or 'B' indicates that the $i$-th ghostfire is colored red, green, or blue, respectively.

翻译中…

If there are multiple answers, output any.

翻译中…

Note

翻译中…

For the first test case, "B" is the only valid construction.

翻译中…

For the second test case, "RGB", "RBG", "GRB", "GRB", "BRG", and "BGR" are all correct.

翻译中…

For the third test case, "GG" and "GGG" are invalid because $s_1=s_2$.

翻译中…

样例

Input #1
5
0 0 1
1 1 1
0 3 0
2 2 2
2 7 3
Output #1
B
RGB
G
GBRBRG
GRGRGBGBGBG
InputCopy OutputCopy
题目信息
题号
2209D
时间限制
2 s
内存限制
256 MB
标签
构造
贪心

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