| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 (추가 시간 없음) | 1024 MB (추가 메모리 없음) | 86 | 10 | 7 | 10.448% |
Mosa is an abstract artist. All of her paintings can be represented as a rectangular grid of black and white unit squares.
Lina is an art collector. His favorite hobby is counting black squares in Mosa’s paintings. One day, he took one of her paintings of $R$ rows and $C$ columns, and recorded an $R$-by-$C$ matrix, such that the number at row $r,ドル column $c$ in the matrix equals the number of black unit squares in the 3ドル$-by-3ドル$ square region centered at the square at row $r,ドル column $c$.
Unfortunately, the very next day Lina found that the artwork is missing! All he has now is the matrix of numbers. Can you help Lina recover Mosa’s painting?
Lina might have made a mistake while writing down the numbers, so it is possible that such a painting does not exist for a given matrix.
The first line contains two integers $R$ and $C$ separated by a space.
The next $R$ lines contain $C$ nonnegative integers each, also separated by a space. Each number does not exceed 9ドル$.
If such a painting exists, output 1 on the first line, and the painting over the next $R$ lines. Each line should be a string of length $C,ドル consisting of characters B (for Black) and W (for White). If multiple paintings satisfy the condition, output any one of them.
If such a painting does not exist, output 0 on the first line.
5 5 4 6 6 6 4 6 8 8 8 6 6 8 8 8 6 6 8 8 8 6 4 6 6 6 4
1 BBBBB BBBBB BBWBB BBBBB BBBBB
4 4 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 0
0
University > KAIST > KAIST ICPC Mock Competition > 2024 KAIST 14th ICPC Mock Competition H번