Hi Codeforces Community,
I recently learnt about segment trees and enjoyed it a lot. Right now, I am trying to solve a problem http://www.spoj.com/problems/MKTHNUM/.
The approach I used was to build the segment tree but maintain a sorted array at each segment. Afterwards, for each query [L, R], I got all the disjoint segments that form [L, R] and merged them recursively in order to answer query. I realize that there is a faster way to answer each query in lgn, (lgn)^2 times. I also think it is related with persistent segment tree.
I have tried to access Anudeep's tutorial on it but it is not loading. Please can someone help with an example or idea of how Persistent segment trees work?