atcoder#ARC131E. [ARC131E] Christmas Wreath
[ARC131E] Christmas Wreath
Score : points
Problem Statement
Takahashi has Christmas decoration consisting of balls and ropes. The balls are numbered to , and for any two different balls, there is exactly one rope that connects them.
He decides to light up each rope in red, blue, or white.
For better appearance, he wants to satisfy all of the following conditions.
Condition 1 the numbers of ropes lighted in red, blue, and white are all equal.
Condition 2 there is no triple of integers such that all of the following three ropes have different colors:
- the rope connecting and ,
- the rope connecting and ,
- the rope connecting and .
Create a way to light up the ropes to satisfy the conditions. If there is no such way, report so.
Constraints
- is an integer.
Input
Input is given from Standard Input in the following format:
Output
If there is no way to light up the ropes to satisfy the conditions, print No
.
If such a way exists, print it in the following format:
Yes
Here, the character should be the following:
-
R
when lighting up the rope connecting Balls and red, -
B
when lighting up the rope connecting Balls and blue, -
W
when lighting up the rope connecting Balls and white.
4
No
For , there is no way to light up the ropes to satisfy the conditions, so the output No
is correct.
Below is an example of an output in the Yes
case, which is incorrect in this case. This is because, for in Condition 2, the rope connecting is red, the rope connecting is white, and the rope connecting is blue, all of which have different colors.
Yes
RBW
WB
R