Codeforces Global Round 26
A
Strange Splitting
Codeforces
800
原题
←B →
翻译中…

Define the range of a non-empty array to be the maximum value minus the minimum value. For example, the range of $[1,4,2]$ is $4-1=3$.

翻译中…

You are given an array $a_1, a_2, \ldots, a_n$ of length $n \geq 3$. It is guaranteed $a$ is sorted.

翻译中…

You have to color each element of $a$ red or blue so that:

翻译中…
  • the range of the red elements does not equal the range of the blue elements, and
  • there is at least one element of each color.
翻译中…

If there does not exist any such coloring, you should report it. If there are multiple valid colorings, you can print any of them.

翻译中…

Input

翻译中…

The first line contains a single integer $t$ ($1 \leq t \leq 100$) — the number of test cases.

翻译中…

The first line of each test case contains an integer $n$ ($3 \leq n \leq 50$) — the length of the array.

翻译中…

The second line of each test case contains $n$ integers $a_1, a_2, \ldots, a_n$ ($1 \leq a_i \leq 10^9$). It is guaranteed $a_1 \leq a_2 \leq \ldots \leq a_{n - 1} \leq a_{n}$.

翻译中…

Output

翻译中…

For each test case, if it is impossible to color $a$ to satisfy all the constraints, output $\texttt{NO}$.

翻译中…

Otherwise, first output $\texttt{YES}$.

翻译中…

Then, output a string $s$ of length $n$. For $1 \leq i \leq n$, if you color $a_i$ red, $s_i$ should be $\texttt{R}$. For $1 \leq i \leq n$, if you color $a_i$ blue, $s_i$ should be $\texttt{B}$.

翻译中…

Note

翻译中…

In the first test case, given the array $[1, 1, 2, 2]$, we can color the second element blue and the remaining elements red; then the range of the red elements $[1, 2, 2]$ is $2-1=1$, and the range of the blue elements $[1]$ is $1-1=0$.

翻译中…

In the second test case, we can color the first, second, fourth and fifth elements $[1, 2, 4, 5]$ blue and the remaining elements $[3]$ red.

翻译中…

The range of the red elements is $3 - 3 = 0$ and the range of the blue elements is $5 - 1 = 4$, which are different.

翻译中…

In the third test case, it can be shown there is no way to color $a = [3, 3, 3]$ to satisfy the constraints.

翻译中…

样例

Input #1
7
4
1 1 2 2
5
1 2 3 4 5
3
3 3 3
4
1 2 2 2
3
1 2 2
3
1 1 2
3
1 9 84
Output #1
YES
RBRR
YES
BBRBB
NO
YES
RBBR
YES
RRB
YES
BRR
YES
BRB
InputCopy OutputCopy
题目信息
题号
1984A
时间限制
1 s
内存限制
256 MB
标签
构造

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