Marr E.O. is currently working on his next video game. He is creating a side-scrolling game and wants you to ensure that the levels that he is creating are possible to complete. The character in the game, Loo E.G., can only jump a certain height (). Throughout the game there are walls with openings created in them for Loo E.G. to jump through. Loo E.G. can go through these openings as follows: he first jumps vertically up to spaces, then he moves two spaces horizontally through the opening, and finally falls vertically on the other side of the wall. Marr E.O. thinks he created the walls such that it is possible for Loo E.G. to complete the level, but he wants you to check. Marr E.O. provides his levels in a text format, where each symbol has a meaning:
- A dot
.means there is nothing there, and Loo E.G. can move freely through that space.
- A hash
#represents the ground (last row of the input).
- An at-symbol
@represents the wall, which cannot be passed through or stood upon.
- The letters
Gare used to represent where Loo E.G. start and end respectively. The start point is guaranteed to be left of the end point. Both points are guaranteed one space above the ground.
The input will contain 10 datasets. Each dataset begins with a line containing three integers , representing the jump height of Loo E.G. and the width and height of the level. lines follow, each containing ASCII characters representing the level (as shown above).
For each dataset, output
CLEAR if Loo E.G. is able to complete the level, or a single integer that
represents the first column that Loo E.G. is unable to reach.
Sample Input (Two Datasets Shown)
2 10 5 .......... [email protected] [email protected] [email protected] ########## 1 10 5 .......... [email protected]@@... [email protected] [email protected] ##########
Educational Computing Organization of Ontario - statements, test data and other materials can be found at ecoocs.org