Correct answer on manual input but none of the test cases are passing
Correct answer on manual input but none of the test cases are passing https://ide.codingblocks.com/s/289137
@tusharnitharwal your implementation is incorrect!
(fails even on sample case)
one of the major flaws are:
- what if for instance you cannot find any new edge to be included in MST? you add 1e9 to cost!
- once you move towards other edge from current edge, you ignore all connections for this current edge even if they were optimal to be included.
I think i have accounted for point 2 and i have run this manually on around 3 different inputs and am getting the correct output. Can you please elaborate more?
you can send me any of the failing test cases
your code was failing on the sample case itself.
another test 
6 15
0 2 44
4 0 38
5 4 58
5 3 11
1 4 61
3 0 38
5 2 37
3 4 65
1 2 49
0 5 98
1 5 5
4 2 53
0 1 98
3 2 70
3 1 67
correct answer is 129.