P6194 [EER1] Soviets
Background
~~The problem title is just to attract you to click in.~~
This is a normal problem, and it has nothing to do with the Soviet Union.
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 \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 $8$ lines, each with $8$ characters, describing the state of the chessboard.
`.` indicates an empty square, `R` indicates a rook, and `B` indicates a bishop.
Output Format
There are $8$ lines, each with $8$ characters. If a square is a valid square to place the king, output `1`; otherwise output `0`.
Explanation/Hint
For $100\%$ of the testdata, it is guaranteed that only `.` , `R` , and `B` will appear.
This problem has $4$ subtasks, and the constraints for each subtask are as follows:
Subtask $1$ ($10$ points): It is guaranteed that only `.` will appear.
Subtask $2$ ($20$ points): It is guaranteed that there will be only one `R` or one `B` (they will not appear at the same time).
Subtask $3$ ($30$ points): It is guaranteed that there is only one `.`.
Subtask $4$ ($40$ points): No special constraints.
Translated by ChatGPT 5