brokie's blog

By brokie, history, 5 weeks ago, In English

Hello everyone! I am trying to solve the following problem:

You are given a DSU (Union Find) data structure, and you need to do the following queries efficiently:

  • Go back to time t, and insert a union operation (Union(u, v, t)) at time t.
  • Undo the union at time t.
  • Given time t, and two nodes u, v check if nodes u and v are in the same connected component at that time.

Any help or offline / online solution would be perfect!

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