Tc are getting failed..whats the issue?

@garganshul151 try this test:
2
3 0 2 1
6 6 2 5
1 3
3 4
2 4
1 2
2 3
5 6
here for first test answer is 6 but your code’s output is 0

https://ide.codingblocks.com/s/305737…corrected that still tc are failed

1
3 1 2 1
1 2

@garganshul151 now try above case: answer should be 5, but yours is 3, See the point is that if there are no edges, then presence of city is ignored!

https://ide.codingblocks.com/s/305737…i have updated plz see now

will anyone reply to this?

@garganshul151 this passes all tests https://ide.codingblocks.com/s/308340
updates are:

  1. use unordered_map
  2. graph g is declared inside while loop
  3. use long long type