The problem was impossible to accept!!!
Послано
黄源河 22 апр 2004 21:14
Re: It is possible!
Послано
黄源河 23 апр 2004 11:27
How can you do it, I'am puzzled. Can you solve it today???
Edited by author 23.04.2004 11:29
I used Dijkstra algorithm with Heap.
I have solved it with 2 BFS
Re: I have solved it with 2 BFS
how?
1 BFS for finding shortest amount of boot change. Another one for shortest path.
First. You can contract all regions in one vertex.
Second. You can find shortest distance by regions.
Third. Remove useless regions. BFS what was left.
Re: 1 BFS for finding shortest amount of boot change. Another one for shortest path.
I don't agree your opinion.The method can't work out in time.This method I had used to solve,but fail.
First. You can contract all regions in one vertex.
Second. You can find shortest distance by regions.
Third. Remove useless regions. BFS what was left.
It's right solution. It has implementation in O(N*M).
Re: It's right solution. It has implementation in O(N*M).
Now I know that's used colouration.
Edited by author 29.04.2004 16:37
Of course, Dijkstra + Heap should get AC (-)
I got TL on test 16 :( (-)
Re: 1 BFS for finding shortest amount of boot change. Another one for shortest path.
I don't agree your opinion.The method can't work out in time.This method I had used to solve,but fail.
Why?
I have impelemnted in O(N*M) --> AC in 0.359 s
Re: Of course, Dijkstra + Heap should get AC (-)
Re: 1 BFS for finding shortest amount of boot change. Another one for shortest path.
but i think it's possible that such condition appears:
in the first BFS to find shortest distance by Changing Boots,there may be many ways to get the shortest Changes.
but these ways are different in shortest way of Walking.
So?
Re: 1 BFS for finding shortest amount of boot change. Another one for shortest path.
I do not understand :(
in the first BFS to find shortest distance by Changing Boots,there may be many ways to get the shortest Changes
First BFS is for
shortest distance by Changing Boots
Then we throw away all useless regions and use SECOND BFS for
shortest way of Walking
Of course for each region we store min boot change to get to it. While finding shortest walking distance we almost ignore regions. Why almost: we make jumps only on regions with higher boot changes. So we can avoid saw-like regions.
Re: Of course, Dijkstra + Heap should get AC (-)
Послано
hello 17 май 2004 17:40
So fast !!!!!!
I got TLE on test 16 all the time ........
I don't know what does "colouration" mean .
Could you explain ?
Could you say your way ?
Re: Of course, Dijkstra + Heap should get AC (-)
Oberon (Yura Znovyak) had told the method very clarity.
So fast !!!!!!
I got TLE on test 16 all the time ........
I don't know what does "colouration" mean .
Could you explain ?
Could you say your way ?
Re: Of course, Dijkstra + Heap should get AC (-)
Послано
hello 26 июн 2004 11:32
Thanks .
I just uesd 0.187s to get AC !
Re: 1 BFS for finding shortest amount of boot change. Another one for shortest path.
It's very nice method! I have got AC in 0.203s