Problem link - 1040 - Donation
Its a very basic mst problem.
let us try to analyze some test case
2
27 26
here
we can see if we keep only the cable with 1 meter then all rooms are connected
and we can donate all other cables so the answer becomes (27+26+52+1) - 1 = 105
stdout
Case 1: 105
4
0 1 0 0
1 0 0 0
0 0 0 1
0 0 1 0
No comments:
Post a Comment