vermish77's blog

By vermish77, history, 7 weeks ago, In English

I think my solution has a time complexity of O(nlogn) as I am doing binary search on answer but it still gives TLE, why is it giving TLE . This is the problem link:- https://codeforces.net/contest/126/problem/B

This is my solution:- https://codeforces.net/contest/126/submission/271378723

Please help in this

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

»
7 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it

The function f works in "n square" complexity in the worst case for comparing deque again and again.

  • »
    »
    7 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Thanks, overlooked it, I think it will need to be solved using KMP then.