Help needed in debugging. Dijktra's Algo

My code is failing the first test case. Could you please tell me where i am going wrong in finding the shortest distance?

There are few mistakes in your code. I am pointing them, plz check

  1. line 63 should be if(it.first!=src){ ans.push_back(it.second); } i.e don’t insert distance if it.first is source
  2. while printing final output, condition should be
    if(it == INT_MAX)
    cout << -1 << " “;
    else cout<< it <<” ";
  3. Don’t use unordered map, use simple map
  4. make dist[i]=INT_MAX; for all 1<=i<=v not for1<=i<=m

@utkarshvashisth94
I have modified your code and fix all errors as per above comments. please check updated code here
https://ide.codingblocks.com/s/246228

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.