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

Автор Me_iS_NooB, история, 2 года назад, По-английски

i was trying to solve this problem:- https://codeforces.me/contest/1801/problem/B

My solution :- https://codeforces.me/contest/1801/submission/278323418

In my solution i wrote a O(nlogn) solution and the judge is showing time limit exceeded. But in editorial the solution given is O(nlogn) and that is getting passed. I am having trouble understanding how this is happening.

plzz help :,(

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

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

set has its own object function lower_bound to use. Do not use lower_bound in algorithm.h, as performing it on set would most of the time cause an $$$\mathcal{O}(n)$$$ time complexity per call.

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

Cuz your sol is not O(nlogn), dummy.