Please read the new rule regarding the restriction on the use of AI tools. ×

Almost Union-Find problem solution, HELP

Revision en1, by ThirtyDays, 2020-12-29 14:34:51

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.

Tags #dsu, disjiont-set-union

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en5 English ThirtyDays 2020-12-29 16:48:24 3 Tiny change: '/eGhngn)\n[Correct' -> '/eGhngn)\n.\n[Correct'
en4 English 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 English ThirtyDays 2020-12-29 16:11:14 7 Tiny change: 'tunionfindhttp://)\nIn this' -> 'tunionfind)\nIn this'
en2 English ThirtyDays 2020-12-29 14:36:08 24
en1 English ThirtyDays 2020-12-29 14:34:51 466 Initial revision (published)