Given a grid of R x C. A cell (r1,c1) is known to be red, while another cell (r2,c2) is known to be blue.
Fill the cells in the grid with either blue of red such that:
1) The cells of same color is connected (connectivity in the sense of adjacent in the 4 directions up, down, left, right)
2) The shape formed by red cells and the shape formed by blue cells are of same shape. (That is, the set of blue cells can be obtained from red cells using only shifts, rotations and reflection).
Warn: 本題有 specialjudge
The first line contains an integer T, indicating the number of testcase.
Each testcases consists of six numbers: R, C, r1, c1, r2, c2.
1 <= T <= 1000
1 <= R,C <= 100
(r1,c1) and (r2,c2) are valid and does not represent a same cell. Rows and Columns are numbered starting from 1.
For each testcase, output a plausible solution. In case the task is impossible to be done, output "IMPOSSIBLE".
Print a blank line between each testcases.
2 1 6 1 5 1 4 3 8 1 5 1 2
IMPOSSIBLE BBBBRRRR BBBBRRRR BBBBRRRR
Migrated from old NTUJ.
IPSC
No. | Testdata Range | Score |
---|