Moderator: Board moderators
rio wrote:Even though you got a way out of MLE, i think you'll get TLE.
I tried your code with STL Queue, and got TLE. This is the code.
In your code, same places could be expanded (queued) several times.
And it is determing min-distance for all the places.
0 2 1 9 9
1 9 1 0 0
1 1 1 9 0
9 9 9 9 0
rio wrote:Little hint for implementing a priority queue with 10 queues :
If you queued out a element from the i th queue, and expand it, and its adjacent element had value '6', you just need to queue it in (i + 6)%10 th queue.
In this way, you don't need to queue distance information.
(It's like a ring, so I used "ring_queue" for the queues variable name)
Users browsing this forum: No registered users and 1 guest