Here is the question-> https://www.codechef.com/problems/REVERSE
I have implemented the algo described in the editorial which is basically dijkstra’s algorithm but don’t know why i am getting WA.
here is my solution-> https://www.codechef.com/viewsolution/18741652
@swapnil159 The problem is with your implementation of Dijkstra’s algorithm.
More than my words I think this test case will tell you where the problem is:
Your this condition:
if will be true for all cases(not sure for all but for most cases because in your implementation you’ve used
for which kinda scares me). This is because you push all the nodes in the set
I think by now you may have understood where the problem is, but I can explain it more if still, it isn’t clear.
(Here is my submission: https://www.codechef.com/viewsolution/18753287)