ECOO '19 R1 P3 - Side Scrolling Simulator

View as PDF

Submit solution

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

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

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 Specification

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 Specification

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]
[email protected]
[email protected]
##########
1 10 5
..........
[email protected]@@...
[email protected]
[email protected]
##########

Sample Output

8
CLEAR

Educational Computing Organization of Ontario - statements, test data and other materials can be found at ecoocs.org


Comments