Need help for this disjoint set problem.

Revision en1, by light42, 2015-07-22 09:19:23

Click here for the problem

At first sight, it seems that it can simply be solved using disjoint set ds. But the problem is more complicated because we handle two kinds of sets at once. Can anyone give a hint for this problem? (PS : I've already try to write and proof my solution for 3 days but still get WA. I suspect I didn't cover all the possible cases in the problem. And sorry if I'm not explaining my solution. It's too messed up I don't want to use it anymore.)

Tags disjoint-set, data structures

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English light42 2015-07-22 09:19:23 566 Initial revision (published)