In gym class, you are playing football on an by grid. Everyone in the class is put into one of two teams, and . Team is trying to score towards the right (towards column ), while Team is trying to score to the left (towards column ).
You know the positions of all the players on the field, but not who has the ball. The person with the ball will always try to score a field goal. It will be blocked if there is a member of the opposite team within units directly in front of them (assume all the players are facing the direction they are scoring).
You want to consider every possible scenario. Hence, for each player, assuming they have the ball, will they score or will they be blocked?
Constraints
Subtask 1 [25%]
Subtask 2 [75%]
No additional constraints.
Input Specification
The first line of input contains three integers , , and , representing the dimensions of the grid, and the distance required to block a field goal.
The next lines of input each contain characters. If the -th character on the -th row is an A
or B
, there is a player on that team at that position. Otherwise, the character will be a .
, which indicates an empty position.
Output Specification
Output an by grid where each position is represented by a .
indicating an empty position, a Y
meaning the player would score their field goal, or an N
meaning the player would be blocked.
Sample Input
2 5 2
A.B.A
.BB..
Sample Output
N.N.Y
.YY..
Explanation for Sample
In the first row, the player at from Team A is blocked by a Team B player at . The player at from Team B is blocked by a Team A player at . The player at from Team A has no blockers and thus scores.
In the second row, both players at and from Team B have no blockers from team A within the specified distance and can score.
Comments
whos also hard stuck on case 45 (TLE)