UVA-532 - Dungeon Master

  • UVa Online Judge 解題結果請於 Submit 後,參閱 uHunt
  • 如果你有任何建議與指教,歡迎於下方留言一起討論喔!
  • 本題選為「20170926 / 20110525 大學程式能力檢定 CPE」題目。
  • 相同題目:ZOJ-c124

題意概要

題目給定 3D 迷宮的大小 (長、寬、高),並將每筆測資的迷宮起點與終點分別以 SE 表示,而迷宮的牆壁以 # 表示,迷宮的道路以 . 表示。此外,在這個迷宮中,能夠走的方向有「東、西、南、北、上、下」。試求:從 S 走到 E 的最短路徑。如果無法走到出口,則要輸出 Trapped!


Input

The input file consists of a number of dungeons. Each dungeon description starts with a line containing three integers , and (all limited to in size).


Output

Each maze generates one line of output. If it is possible to reach the exit, print a line of the form Escaped in x minute(s). where x is replaced by the shortest time it takes to escape. If it is not possible to escape, print the line Trapped!


Sample Input

3 4 5
S....
.###.
.##..
###.#

#####
#####
##.##
##...

#####
#####
#.###
####E

1 3 3
S##
#E#
###

0 0 0

Sample Output

Escaped in 11 minute(s).
Trapped!
profile-image
David Lu
Hello, I'm David Lu. I am a graduate student in Department of Computer Science at National Chiao Tung University, Taiwan. I am in the Networking and Sensing Systems (NSS) Lab at NCTU. If you have any question, please feel free to contact with me.
comments powered by Disqus