Need help in Mo's Algorithm DSU part

Revision en1, by goyalnikhil064, 2020-06-17 15:47:49
There is this problem https://www.codechef.com/problems/GERALD07. I tried solving it using Mo algorithm but I am stuck with the dsu. Like when I am going to move left pointer rightwards or right pointer leftwards, then I would need to break the set previously merged. I am not getting how to break the joined set. Plus I know it can be solved by link-cut, but I haven't read that topic so kindly give me suggestions with regard to Mo algorithm. Thanks!
Tags #mos algorithm, #dsu, #graph theory

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English goyalnikhil064 2020-06-17 15:47:49 506 Initial revision (published)