Minimum time traversal problem


Is the given sample test case correct?
I think my code is correct and its giving ans as 130 for the 3rd test case but ans provided is 120.
Also on submitting the code its giving wrong answer verdict.

@nayakashutosh99
Test case 3 is right
You go from 20,20 -> 25, 25 -> 30,30 -> 35,35 -> 50,50 -> 100,100
The pipelines are bidirectional
Please modify your code accordingly

It wasn’t mentioned about bidirectional I guess. Okay got it. Thank you

https://ide.codingblocks.com/s/224630 If I consider the bidirectional property also then how to consider choosing the pipelines in any order to get min time?

@nayakashutosh99
You will need to apply BFS till you reach destination
BFS from any position to unvisited left, right, top and down

Okay will try. Thank you!

1 Like