Hi Codeforces!
I'm trying solve this problem http://www.spoj.com/problems/ZQUERY/ . My code has complexity O( n * sqrt(n) * log(n) ) using Mo's algorithm and Segment tree. But, i get TLE. My code use std::deque to find the solution of each interval.
This data structure is slow in this case? Is there any way to remove log(n)?
Thanks for advance!
My code in cpp: http://ideone.com/pHvCEH