Almost Union-Find problem solution, HELP

Правка en4, от ThirtyDays, 2020-12-29 16:47:56

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.

Теги #dsu, disjiont-set-union

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en5 Английский ThirtyDays 2020-12-29 16:48:24 3 Tiny change: '/eGhngn)\n[Correct' -> '/eGhngn)\n.\n[Correct'
en4 Английский ThirtyDays 2020-12-29 16:47:56 43 Tiny change: '/eGhngn)\n\nI am ' -> '/eGhngn)\n[Correct code](https://ideone.com/ilHep5)\n\nI am '
en3 Английский ThirtyDays 2020-12-29 16:11:14 7 Tiny change: 'tunionfindhttp://)\nIn this' -> 'tunionfind)\nIn this'
en2 Английский ThirtyDays 2020-12-29 14:36:08 24
en1 Английский ThirtyDays 2020-12-29 14:34:51 466 Initial revision (published)