TLE with algorithm O(q * sqrt(n)) Where q = 10^5, n = 10^5?

Правка en2, от Mhammad1, 2015-07-11 19:31:49

I'm trying to solve this problem:

http://codeforces.me/problemset/problem/455/D

My submission:

http://codeforces.me/contest/455/submission/12009574

My algorithm runs in O(q * sqrt(n)) so it should pass the test cases. So the question is: what's wrong in my code to make it giving me TLE?

Теги tle, sqrt_decomposition

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский Mhammad1 2015-07-11 19:31:49 24
en1 Английский Mhammad1 2015-07-11 19:15:11 345 Initial revision (published)