Djisktra problem : test case are failing

i run it on custom input and it shows correct output but while sumbission its showing wrong.

hello @mandeepchohan96
please explain ur approach

my approach :

  1. i had used adjancey list concept to store pairs of (wieght,vertex) for every vertex in code(vector<pair<ll int,int>> graph[n]) ;
  2. i had assumed that counting of vertex starts from 0 . if there are 5 nodes …count starts from 0,1,2,3,4
  3. in this question counting start from 1 so i had used x-1 , y-1 and s-1 instead of x,y,s.
  4. in djisktra functoin i had passed adjancey list,current node,parent node, vector of distance( of each node from s-1 node) and it is passed by refrence.
  5. then for every node , i go into adjancey list to find all its nieghbours and compare thier distance with (new distance) to that node if it is less and then update it and then make djisktra function call from that node. with its updated wieght
  6. i had taken test case from GFG to check it accuracy. and i had increased all nodes value by 1 to compensate x-1 and y-1

i had change little code in end . even if you remove that (node : ) part…it still not able to sumbit succesfully

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.