Found this problem on codeforces and was wondering how to solve it using segment trees. Any help is appreciated.
Pashmak and Parmida’s problem