Language:DefaultDungeon Master
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 16855
Accepted: 6564
DescriptionYou is trapped in a 3D dungeon and need to find the quickest-on-the-do out! The dungeon is composed of a unit cubes which m
DescriptionYou is trapped in a 3D dungeon and need to find the quickest-on-the-do out! The dungeon is composed of a unit cubes which may or may isn't being filled with rock. It takes one minute to move one unit north, south, east, west, up or down. You cannot move diagonally and the maze are surrounded by solid rock in all sides.is an escape possible? If Yes, how long would it take?InputThe input consists o
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 isn't possible to escape, print the line
trapped!
Sample Input3 4 5s.....###. ##.. ###.#############.####...###########.###### #E1 3 3s## #E # # #0 0 0Sample OutputEscaped in minute (s). trapped!Remember before is to look at the problem to do out, today and do again, 1 A, sure enough the topic is good. This probl
Dungeon Master
Time limit:1000 ms
Memory limit:65536 K
Total submissions:16089
Accepted:6241
DescriptionYou are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or m
Dungeon Master
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 16178
Accepted: 6268
Description you is trapped in a 3D dungeon and need to find the quickest it is out! The dungeon is composed of a unit cubes which may or may isn't being filled with rock. I
Link: http://poj.org/problem? Id = 2251 http://acm.hust.edu.cn/vjudge/contest/view.action? Cid = 22009 # Problem/edungeon master
Time limit:1000 ms
Memory limit:65536 K
Total submissions:14103
Accepted:5477
DescriptionYou are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes
Because the postgraduate school has been in the review of high number of English, the results even such a simple question will not be, sure enough to learn algorithm or need uninterrupted practice, today to the high number of books on the book, to give yourself a relaxation practice algorithm.Dungeon MasterTime limit:1000ms Memory limit:65536kTotal submissions:43911 accepted:16567
DescriptionAre trapped in a 3D du
steps -} s, E;//S is used to save the starting point, E to save the end + - voidBFS () + { A intx, y, z, i; at structnode SS; -QueueQ; - Q.push (s); - - while(!q.empty ()) - { inSS =Q.front (); - Q.pop (); to if(ss.i = = E.I SS.J = = E.J ss.k = e.k)//Find the end point, output step number + { -printf"escaped in%d minute (s). \ n", ss.step); the return; * } $ for(i =0; I 6; i++)Panax Notoginseng { -x = ss.i + dir[i][0];
Address: Dungeon Master
Question:
In a 3D image, '.' indicates the blank area, and '#' indicates that the wall cannot pass. Starting from "S", ask if you can reach "E". If you can output how much time, if you cannot output "trapped !".
Solution:
Search for BFs. An error occurs when the VIS array is marked at the beginning, but the coordinates of the point are accessed when the queue is output. This will c
Test instructions: A three-dimensional maze, the three-side length is r,n,m, (Analysis: The state is only 30*30*30,BFS can be, no meaning#include #include#include#include#includeusing namespacestd;Const intmaxn= *;CharG[MAXN][MAXN][MAXN];intvis[maxn][maxn][maxn],r,n,m;intSx,sy,sz,ex,ey,ez;Const intdz[7]={0,0,0,0,0,1,-1};Const intdx[7]={0,-1,1,0,0,0,0};Const intdy[7]={0,0,0,-1,1,0,0};structnode{intx,y,z,v; Node (intAintBintCintd): X (a), Y (b), z (c), V (d) {}};queueQ;intBFs () { while(!Q.empty (
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.