Need help with implementation of MST Queries

Problem : https://www.codechef.com/problems/MSTQS (based on minimal spanning tree and Kruskals)
Editorial : MSTQS - Editorial
My solution : https://www.codechef.com/viewsolution/27993566
I understand everything that has been said in the editorial. But the links to author and tester solutions are unavailable. My code is passing all TCs of subtask 2; but not some of 1 and 3. I have tested as thoroughly as I could. Would appreciate if someone can point out bug(s). zwe stand for zer-weighted edges in code.

1 Like