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