시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 1024 MB | 3 | 3 | 3 | 100.000% |
Given is a rectangle consisting of r × c unit squares. One of these squares, in row rr and column cr, is colored red. A different square, in row rb and column cb, is colored blue.
Color each of the remaining squares red or blue in such a way that the red part and the blue part have the same shape. (That is, the set of blue squares can be obtained from the set of red squares by using shifts, rotations and reflections.)
A set of squares S is connected if it is possible to travel between any two of them without leaving S, using horizontal and vertical steps only.
The first line of the input file contains an integer t specifying the number of test cases. Each test case is preceded by a blank line.
Each test case consists of three lines. The first line contains the dimensions r and c. The second line contains the coordinates rr and cr. The third line contains the coordinates rb and cb. You may assume that 1 ≤ rr,rb ≤ r ≤ 100, 1 ≤ cr,cb ≤ c ≤ 100, and (rr,cr) ≠ (rb,cb).
For each test case, output r lines containing c characters each, each of the characters being R (red) or B (blue). If there are multiple solutions, pick any of them. If there is no solution, output one line with the string “IMPOSSIBLE”. You may output empty lines between test cases.
3 5 5 1 1 3 4 4 6 1 1 4 6 4 6 1 1 1 2
IMPOSSIBLE RRRRRR RRRRRB RBBBBB BBBBBB RBBBBB RBRRRB RBBBRB RRRRRB