karishma_gupta's blog

By karishma_gupta, history, 3 years ago, In English

https://codeforces.com/contest/448/submission/96518240 I think the complexity is O(n^2) and so, I can't figure out as to why does it TLE? I have been trying to debug it and optimize it for hours. Any help would be appreciated.

  • Vote: I like it
  • -12
  • Vote: I do not like it

| Write comment?
»
3 years ago, # |
  Vote: I like it +3 Vote: I do not like it

After seeing the title I thought, you are gonna help me with this problem..

»
3 years ago, # |
  Vote: I like it +8 Vote: I do not like it

In case of increasingly sorted input data your solution has O(2^n) time complexity.