Problem link In this all first and third operatio is same DSU. But in second operation move(a,b) we have to move elment a to grounp containing b.
My approach: Instead of changing parent structure, I am using a diffrent a vector parent2 for updating parent of element in move operation.
code. Code
I am getting wrong answer.