QCHEF — Help needed with Mo's Algorithm

Revision en1, by Death_Scythe, 2016-06-30 22:48:54

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!

Tags codechef, mos_algorithm, segment tree, help

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Death_Scythe 2016-06-30 22:48:54 545 Initial revision (published)