Cyber Attack Problem

I am getting wrong answer in Cyber attack problem -
My code - https://ide.codingblocks.com/s/346485
problem link - https://hack.codingblocks.com/app/contests/1798/668/problem
Please Help!

tell me ur approach

ohk ur logic is right but i think ki apne DSU galat implement kiya hai
try to implement find_parent and merge dsu functionalities with some other implementation.

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.