I recently learned the DSU algorithm and was trying a problem from CodeChef’s easy section. I am getting WA, can you please help me in the logic building part, is my dsu implementation correct? I tried to understand from the setters solution, but could not understand. can you please help me in debugging the code?
Link to my code: https://ide.codingblocks.com/s/239362
Link to question : https://www.codechef.com/problems/GALACTIK