WA in GALACTIC

I am not understanding, why I am getting WA in this question, please suggest me some of the test case :
my code

your code is giving WA for the case
8 7,1 3,3 5,5 7,2 4,4 6,6 8,7 8,-1,-1,-1,-1,-1,-1,-1,-1 The ans is 0 and ur pgm is giving -1…the reason is that all the planets are connected so their is no cost of construction…irrespective of the invidual cost of each planet u gv…

thank you for pointing this out, but still WA :frowning: any more test cases…

for 1 0,-1 ans should be 0 for any cost bt ur pgm is giving -1…

1 Like

its giving 0 not -1.

failing for the test case 5 3,1 2,2 3,4 5,1,2,-1,0,-1 giving -1 but ans should be 1…

thank you hatim :slight_smile: got AC :slight_smile: