АВТ
Language:

Remote Training on Programming

Problems On-line status Contests FAQ
For authors:
Register  ||  Login
 
Hello, Guest! Login or register.

246. Path in Labyrinth

Time Limit: 1 seconds
Memory Limit:65536KB
Points:5
View Problem Statistics Submit Problem added Undefined

Дан клетчатый лист бумаги, в котором некоторые клетки закрашены. Требуется найти кратчайший путь из левой верхней клетки в правую нижнюю. Двигаться можно только по вертикали или горизонтали.

Input

Пустая клетка представлена символом '.', закрашенная - символом '#'. Число строк и столбцов не превышает 500.

Output

Такое же представление лабиринта, в котором найденный путь изображен символом '*'

Sample

InputOutput
..........
.#..#.....
..#..####.
...#.#....
###.....##
.....##.#.
......#...
****......
.#.*#.....
..#**####.
...#*#....
###.****##
.....##*#.
......#***

Если пути не существует, выведите одно слово "IMPOSSIBLE"


View Problem Statistics Submit Author/source:
Sorted Problems / Graphs /
292. One-way Racing 246. 297. Races 170. Spanning Tree 877. Traffic
Educational Courses / Data Structures and Algorithms / Graph Algorithms /
9. Net 246. 297. Races 267. from Muha to Slon 205. Игра в города
We can all benefit by doing occasional "toy" programs, when artificial restrictions are set up, so that we are forced to push our abilities to the limit. The art of tackling miniproblems with all our energy will sharpen our talents for the real problems. Donald E. Knuth.
time generating 0.687 sec.
© Copyright VSTU, AVT, Nosov D.A.