Блог пользователя _All-Might_

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

Hello coders I hope you are all well

Can anyone tell me why my solution get TLE for this problem problem : code : Thank u all :)

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

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

Haven't examined the whole code, but one issue that jumps out is that you use lower_bound for the set wrongly. The way you use it, it works slower than $$$O(\log n)$$$ (either $$$O(n)$$$ or $$$O(n \log n)$$$, don't remember exactly). When you use lower_bound or upper_bound for a set-like structure, you should call it as a member function.