Page 3 of 3

532

Posted: Thu May 26, 2011 11:07 pm
by live_lie
can anyone please help me to understand this problem.. actually how i need to thing or how i use bfs here...what are the vetices or edges....?

Re: 532

Posted: Wed Jul 24, 2013 3:10 pm
by shuvokr
emma042 cheak this input

Code: Select all

3 4 5
SE...
.###.
.##..
###.#

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

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

0 0 0
Out should be

Code: Select all

Escaped in 1 minute.

Re: 532

Posted: Wed Jul 24, 2013 10:54 pm
by brianfry713
Output should be:

Code: Select all

Escaped in 1 minute(s).

Re: 532

Posted: Thu Jul 25, 2013 12:12 am
by shuvokr
May be for this problem there is no input which result is "Escaped in 1 minute(s)." because my ac code for result 1 print "Escaped in 1 minute."

Re: 532

Posted: Fri Nov 15, 2013 3:06 pm
by chanderg_12
Why not use Dijkistra?Though all edges are basically 1 or INF , still it should do the trick right?

Re: 532

Posted: Fri Nov 15, 2013 9:20 pm
by brianfry713
Dijkstra's algorithm would work the same as BFS with all edges of weight 1. It is less efficient though.

Re: 532

Posted: Wed Nov 20, 2013 6:05 pm
by chanderg_12
Thanks. Ya, I get it.I saw paths and was naively led to Dijkstra's.
And this works only because of constant edge length right? As we cover all vertices of each depth before going farther from the source, we end up with the optimal path.

Re: 532

Posted: Wed Nov 20, 2013 10:03 pm
by brianfry713
yes

uva 532

Posted: Sun Nov 24, 2013 12:59 am
by walking_hell
thanx for the reply brianfry...i got it accepted...i misunderstood the problem..

Re: uva 532

Posted: Mon Nov 25, 2013 11:47 pm
by brianfry713
I just ran a single BFS from the start to the exit. What are you trying to do?