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
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!
will anyone reply to this?
@garganshul151 this passes all tests https://ide.codingblocks.com/s/308340
updates are:
- use unordered_map
- graph g is declared inside while loop
- use long long type