_All-Might_'s blog

By _All-Might_, history, 18 months ago, In English

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 :)

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
18 months ago, # |
  Vote: I like it 0 Vote: I do not like it

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.