ZQUERY — SPOJ — std::deque is slow? [SOLVED — PARTIALLY]

Revision en3, by Juniorandrade, 2015-10-11 08:00:29

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

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en4 English Juniorandrade 2015-10-11 09:09:45 12
en3 English Juniorandrade 2015-10-11 08:00:29 15 (published)
en2 English Juniorandrade 2015-10-11 07:59:30 21 (saved to drafts)
en1 English Juniorandrade 2015-10-10 23:11:22 425 Initial revision (published)