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

Автор alyosha, история, 13 месяцев назад, По-английски

https://codeforces.me/contest/2149/submission/340722817 this is my submission it is failing by TLE on testcase 15. I don't understand why. I have implemented the same approach as given in the editorial. I compress the values of array A and the do 50 tries of randomly checking if count of some value in [L, R] > (r — l + 1)/3.

Any help will be appreciated. Thanks

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

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

The reason of TLE is big constant behind your solution.

If you improve line 54 of your solution from $$$O(\log(n))$$$ to $$$O(1)$$$, you will get AC: 340741082

From 4.5s+ to 1.9s.