|| ||Code Submission Evaluation System
HIIT Open 2016
Tasks | Messages | Scoreboard | Statistics
CSES - HIIT Open 2016 - Graph paintingCSES - Graph painting
|Time limit:||1.00 s|
|Memory limit:||256 MB|
You are given a simple, undirected graph that consists of $n$ nodes and $m$ edges.
Your task is to paint each node red or blue so that there are at least $\lfloor m/2 \rfloor$ edges such that their nodes have a different color.
The first input line contains an integer $t$: the number of test cases. After this, there are $t$ test cases that are described as follows:
The first line contains two integers $n$ and $m$: the number of nodes and edges in the graph. The nodes are numbered $1,2,\ldots,n$.
After this, there are $m$ lines that describe the edges. Each line contains two integers $a$ and $b$. This means that there is an edge between nodes $a$ and $b$.
For each test case, output a line that contains $n$ space separated characters that describe the colors of the nodes. Each character must be R (red) or B (blue).
There is always a solution, and you can output any valid solution.
- $1 \le t \le 100$
- $2 \le n \le 10^5$
- $1 \le m \le 2 \cdot 10^5$
- the sum of all $n$ and $m$ values it at most $10^6$
B B R B
R B B B B