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

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

Hi, I am facing some confusions about the time complexity of the codes we submit. If the time limit per test=1 second,

doesn't that mean if t=3, total 3*1 seconds will be needed at max? I mean maximum 3 seconds in total is available , right?

My submission

According to my calculation, the time complexity of my provided solution is

n*log(a_max), where a_max= max(vector a)

I am confused why it is getting TLE everytime.

And I think I have little knowledge, so asking.

Do enlighten me with your knowledge's lumen.

Thanks

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

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

No it's of course TLE, because it does not guarantee anything

So if there is a test which t = 10^4 and in every testcase there is l = 1 and r = 2*10^5

Then your code will run in O(t*(r-l+1)) which is O(2*10^9) and gives TLE