Algo Dijkstra Coding Problem

https://ide.codingblocks.com/s/97653 Sir, The hidden test case failed. Please check. I have written this code according to the video lecture on it. I could not understand why we include auto f=s.find(make_pair(nn,dest[nn]));
if(f!=s.end()){
s.erase(f);
}
Please explain the logic.

Hey
This means if the given pair 'f’is found, then remove it from set, and after that I think you know the logic of inserting appropriate pair.
if(f!=s.end()) is basically how we test if a given pair is found in set or not.

Ma’am, please check why the code is not working for the hidden test case

Hi
1
4 3
1 2 2
1 1 1
3 1 3
2
Your answer is 2 5, but it should be 2 5 -1, as there are 4 nodes but 4th one is not reachable from source

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.