## DWITE '09 R4 #5 - Ice Maze

View as PDF

Points: 10
Time limit: 1.0s
Memory limit: 64M

Problem types
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
##### DWITE Online Computer Programming Contest, January 2010, Problem 5

Yes, it's a maze, but it's one of those fancy puzzle mazes where there is no friction on the floor and one must bump into walls to stop.

• # — wall
• . — frictionless open space
• A-F — points of interest

You will start at a point of interest, and must traverse to the next point in alphabetical order. You may only travel in straight lines, and will continue to slide until there is a # wall directly in front of the path. Once stopped, you can push off in any of 4 directions. Assume that the maze's boundary is surrounded by walls.

The objective is to stop at the target, not simply slide through it.

For example, in a distance of 13. Note that arrows are to illustrate the shortest path, and will not actually be in the data file.

A>>>#
###v#
^>>B#
<<<v#
...##


The input will contain a single 10x10 maze as describe above.

The output will contain 5 integers, distance travelled from starting at a point of interest to stopping at the next. That is, sets A-B, B-C, C-D, D-E, E-F.

#### Sample Input

A....E...B
..........
..........
..........
..........
..........
F.........
#.........
......#...
.....D...C

#### Sample Output

9
9
16
9
11

• commented on July 11, 2019, 7:47 p.m.

Is it guaranteed to be possible to reach every checkpoint?

• commented on July 11, 2019, 8:10 p.m. edited

yes

(it is possible to stop at B from A, and C from B, etc)

• commented on July 11, 2019, 8:47 p.m.

Thank you for the clarification.