Please subscribe to the official Codeforces channel in Telegram via the link https://t.me/codeforces_official. ×

PizzaPasta's blog

By PizzaPasta, history, 7 months ago, In English

Hi there!

I just encountered a problem on a forum seemingly uses DSU, but there is a query that makes me question my DSU.

There are a number n and n numbers that follow. There are 3 queries: + Put a and b together + Seperate a and b + Determine whether a and b is connected

I am thinking of a reverse-DSU technique.

Please help!

P/S: Thank you!

  • Vote: I like it
  • +8
  • Vote: I do not like it

»
7 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Rollback DSU

Also instead of saying "put A and B together", "merge/join A and B together" will be more formal.

  • »
    »
    7 months ago, # ^ |
      Vote: I like it +8 Vote: I do not like it

    thank you! i actually meant that but you noticed it first.