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

Автор always_4ever_5_25__21_SS, история, 7 лет назад, По-английски
  1. 33592102
  2. 33592281

In my first submission, I used lower_bound to find the index I want to erase. In my second one, I implement the same idea using ook (order_of_key) and fbk (find_by_order) of ordered_set. My first submission resulted in TLE (time limit 2 sec) where my second submission passed on 233 ms. I don't see any algorithmic difference. Overall Complexity for Worst case O ( n * (logn) * (logn) ). Anyone can point out what I am missing or if I am wrong?

I faced the same thing when I solved CF round 450 div2 C: Remove Extra one. Using the build in lower_bound, I got TLE but got AC when I used ook.

N.B: In my above code, lowerBound() is a user made function. lower_bound() and lowerBound() is different.

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

»
7 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by always_4ever_5_25__21_SS (previous revision, new revision, compare).

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

lower_bound(s[ch].begin(), s[ch].end(), x) is for std::set. Use s[ch].lower_bound(x) to make the binary search in .