#P6194. [EER1] 苏联人

[EER1] 苏联人

Description

You are playing EE Round 1 and find that the first problem is very boring. So you stop and go play chess instead.

Then you realize that, due to some mysterious power, your pieces are left with only some black rooks, some black bishops, and one white king.

Because you are bored, you place some black pieces on an 8×88 \times 8 chessboard.

Because you are bored, you want to know on which squares the king can be placed safely. In other words, which squares are not attacked by any rook or bishop. Of course, the king cannot be placed on a square that already has a piece.

To prevent you from being so bored that you do not know the rules of chess, here are some hints (if you already know the rules, you can skip this):

In chess, a rook can move horizontally or vertically, with no limit on the number of squares. But it cannot jump over other pieces.

As shown, the yellow squares are the squares the rook can move to (attack).

In chess, a bishop can move diagonally, with no limit on the number of squares. But it cannot jump over other pieces.

As shown, the yellow squares are the squares the bishop can move to (attack).

Simply put, if there is another piece on the line segment from the current position to the target position, then it is considered as “jumping over other pieces”.

If the target square contains an opponent’s piece, then after moving to the target square, the opponent’s piece will be captured.

Furthermore, every position you are looking for must satisfy that no black piece can reach it in one move.


If you still do not understand, you can combine the samples to understand.

Input Format

There are 88 lines, each with 88 characters, describing the state of the chessboard.

. indicates an empty square, R indicates a rook, and B indicates a bishop.

Output Format

There are 88 lines, each with 88 characters. If a square is a valid square to place the king, output 1; otherwise output 0.

........
........
........
..B..R..
........
........
........
........

11111011
01110011
10101011
11000000
10101011
01110011
11111011
11111001

Hint

For 100%100\% of the testdata, it is guaranteed that only . , R , and B will appear.

This problem has 44 subtasks, and the constraints for each subtask are as follows:

Subtask 11 (1010 points): It is guaranteed that only . will appear.

Subtask 22 (2020 points): It is guaranteed that there will be only one R or one B (they will not appear at the same time).

Subtask 33 (3030 points): It is guaranteed that there is only one ..

Subtask 44 (4040 points): No special constraints.

Translated by ChatGPT 5