I can see that processing the segments from high to low and using segment tree to update the segment currently covering an interval l, r is necessary to solve this problem. However, i couldn't think of a way to update the segment currently covering l, r as there can be multiple segments that were covering it. Can someone please help ?