atcoder#CODEFESTIVAL2017QUALAD. Four Coloring
Four Coloring
Score : points
Problem Statement
We have a grid with rows and columns of squares. We will represent the square at the -th row from the top and -th column from the left as . Also, we will define the distance between the squares and as .
Snuke is painting each square in red, yellow, green or blue. Here, for a given positive integer , he wants to satisfy the following condition:
- No two squares with distance exactly have the same color.
Find a way to paint the squares satisfying the condition. It can be shown that a solution always exists.
Constraints
Input
Input is given from Standard Input in the following format:
Output
Print a way to paint the squares satisfying the condition, in the following format. If the square is painted in red, yellow, green or blue, should be R
, Y
, G
or B
, respectively.
2 2 1
RY
GR
There are four pairs of squares with distance exactly . As shown below, no two such squares have the same color.
- , :
R
,Y
- , :
Y
,R
- , :
R
,G
- , :
G
,R
2 3 2
RYB
RGB
There are six pairs of squares with distance exactly . As shown below, no two such squares have the same color.
- , :
R
,B
- , :
B
,G
- , :
G
,R
- , :
R
,B
- , :
B
,Y
- , :
Y
,R