Dijkstra's Algorithm

whats wrong?
code:https://ide.codingblocks.com/s/244439
ques:https://hack.codingblocks.com/app/contests/1289/292/problem

your logic and implementation is correct but you are not printing in correct way also you are not considering isolated nodes as it is mentioned that you have to print a single line consisting N-1 space separated integers denoting the shortest distance of N-1 nodes other than from starting position S in increasing order of their labels

isolated nodes means that nodes that don’t have any edge so your adjacency list won’t have these nodes as keys

i have corrected your code :-

In case of any doubt feel free to ask :slight_smile:
mark your doubt as resolved if you got the answer