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

Правка en4, от Juniorandrade, 2015-10-11 09:09:45

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

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en4 Английский Juniorandrade 2015-10-11 09:09:45 12
en3 Английский Juniorandrade 2015-10-11 08:00:29 15 (published)
en2 Английский Juniorandrade 2015-10-11 07:59:30 21 (saved to drafts)
en1 Английский Juniorandrade 2015-10-10 23:11:22 425 Initial revision (published)