ECOO '19 R1 P3 - Side Scrolling Simulator

View as PDF

Submit solution

Points: 10 (partial)
Time limit: 30.0s
Memory limit: 512M

Problem type

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 (J). 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 J 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 L and G are 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.

Input Specifications

The input will contain 10 datasets. Each dataset begins with a line containing three integers J, W, H (1 \le J \le 10, 5 \le W \le 100, 2 \le H \le 10), representing the jump height of Loo E.G. and the width and height of the level. H lines follow, each containing W ASCII characters representing the level (as shown above).

Output Specifications

For each dataset, output CLEAR if Loo E.G. is able to complete the level, or a single integer N that represents the first column that Loo E.G. is unable to reach.

Sample Input (Two Datasets Shown)

2 10 5
..........
.......@..
.......@..
[email protected]
##########
1 10 5
..........
..@..@@...
..@.......
[email protected]
##########

Sample Output

8
CLEAR

Comments


  • 0
    Eric_Zhang  commented on Nov. 5, 2020, 1:22 p.m.

    Clarification: If LOO E.G. can't complete his jump, then he does not jump