ThirtyDays's blog

By ThirtyDays, history, 3 years ago, In English

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.

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it