Test Case not passing

I am able to pass the sample test case but on submission i am getting wrong answer pls guide.
Code id : https://ide.codingblocks.com/s/70672

Question : https://hack.codingblocks.com/contests/c/537/787

@sanjeetboora sir please help

shubham if their is no edge between 2 nodes then ur map of graph will not contain them therefore ur dist map will not contain it because of this there is a problem of printing -1 i ur code
just in test case
make m=3
ans remove edge 1 2
u will get it
it will print 3,15
and it should print
-1 3 15
Also u miss an endl at last

1 Like