| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 13 | 10 | 10 | 76.923% |
Busy Beaver lines up $N$ marbles numbered 1ドル$ through $N,ドル where the $i$-th marble shows a number $p_i \neq i,ドル and every number from 1ドル$ to $N$ appears exactly once among $p_1, \dots, p_N$ (more formally, $p$ is a permutation over 1,ドル \dots, N$ such that $p_i \neq i$).
He wants to paint the marbles so that each marble $i$ has a different color from marble $p_i$. However, he only has three colors: red, green, and blue. Help him find any valid painting.
The first line contains a single integer $T$ (1ドル \leq T \leq 10^4$) --- the number of test cases.
The first line of each test case contains one integer $N$ (2ドル \le N \le 10^5$) --- the number of marbles.
The second line of each test case contains $N$ integers $p_1, p_2, \dots, p_N$ (1ドル \le p_i \le N$; $p_i \ne i$) --- the numbers on the marbles. These numbers form a rearrangement of the numbers 1,ドル \dots, N$ in some order.
The sum of $N$ over all test cases does not exceed 10ドル^5$.
For each test case, output a string of length $N$ containing the characters R, G, and B, where the $i$-th character denotes the color (red, green, or blue, respectively) of the $i$-th marble, satisfying the constraints.
If there are multiple possible answers, you can output any of them. We have a proof that under these constraints, an answer always exists.
5 5 2 1 5 3 4 6 2 1 4 3 6 5 5 2 3 4 5 1 3 3 1 2 4 4 3 2 1
GBBGR BGGRRB RBRBG RGB BRGG
In the first test case, the coloring GBBGR works as follows:
University > MIT > M(IT)^2 > M(IT)^2 Winter 2025-26 Tournament > Beginner Round 3번