Блог пользователя fresher96

Автор fresher96, 11 лет назад, По-английски

problem

i think the intended solution for this problem is O(n lg^2(n))

i used fenwick tree and two multi sets in each node to represent the number of additions and deletion of each number in the input data. i think the complexity of this solution is O(n lg^2(n)) which is pretty much acceptable by problem constrains. however, this solution gets TL on test #11

link

after seeing other fenwick tree based solutions i noticed that the difference is using one map instead of two multi sets. i rewrote the code and indeed it was accepted!

link

can anybody help me with this issue. i don't know where i have gone wrong. switching set to map reduced a TL to a 420 ms AC solution. any help would be appreciated.

btw, what's the problem with codeforces judging system. it seems to be significantly slow.

  • Проголосовать: нравится
  • -1
  • Проголосовать: не нравится

»
11 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +29 Проголосовать: не нравится

The count function is linear in the value it returns which means that if it returns N, then its complexity is O(N).

»
11 лет назад, скрыть # |
 
Проголосовать: нравится +11 Проголосовать: не нравится

tbh codeforces judging system is quite fast in my opinion (If you consider SPOJ's...)