Not able to Submit Cyber Attack

CodeLink -> https://ide.codingblocks.com/s/285311

@imsaurabh
Try this input :
5 7 12
1 2 3
2 3 6
3 4 3
4 5 2
3 1 6
2 5 2
1 4 8

Expected Output :
3 8

Solve this problem using the Kruskal’s Algorithm instead because of a simple reason that you need to work with the edges here and not the nodes. Prims Algorithm picks the nodes one by one to construct the MST.
Approach : To find Maximum Spanning tree , use Kruskal Algorithm to find Minimum Spanning Tree first. Obtain the edges that have been discarded from it. Now sort these edges and try to put them into the tree one by one in reverse order until the total of discarded edges does not exceed the given cost.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.