Pls check error , getting wrong answer

I guess you repeated the question.

Was the previous explanation not clear?

The reason for the wrong answer is that you need to print the minimum distance for each node, in order from node 1 to node n, so you can’t use an unordered_map and print them randomly.

when did you gave me explanantion earlier??

https://ide.codingblocks.com/s/333694 ans is coming write now but testcase not passing pls check

Hi, I am sorry about that.

Someone asked the same doubt and had the same error and very similar code :laughing:.

So is it still WA or is it TLE?

it is wrong answer for the testcase while submitting ,but i’m getting right answer for many testcases which i had tried

You forgot the -1 case.

And also I don’t think it is a directed graph, so add both the edges to the graph, not just one.