Hello!
I am trying to solve this problem https://www.codechef.com/problems/QCHEF using Mo's Algorithm+Segment Tree but my solution times out. Complexity of my solution is . Is it possible to eliminate the log factor? I know there is an editorial with the problem, (it uses a different decomposition, I think) but I am wondering if my solution can be optimised to .
My solution: https://www.codechef.com/viewsolution/10638667
Thanks!