I am not able to pass the test case pls look into this


The answer is correct still not passing pls tesll the error and pls edit the code and send me for better understanding.
Thank you.

@AMAN-2000
There are few mistakes in your code

  1. the graph which is declare outside for loop of testcase should be initialise inside for loop.
  2. condition in line 107 shoulde be for(int i=0;i<m;i++). No. of edges are m not n
  3. change un_ordered map in line 33 to normal map<T,int> dist.
  4. you have missed that condition when some node is not reachable. In that case you have to print “-1” for those nodes.

@AMAN-2000
I have modified your code as per above comments. Please check here

@AMAN-2000

Please ask another doubt from the portal. This is an year old doubt.