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

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

Problem C

My Accepted Solution

According to me, the time complexity of the above code is O(sum*n*n)(sum= sum of the array passed to the function) and hence should result in a TLE verdict(Correct me if I am wrong).Help me in clearing this doubt. Thanks in advance. :)

Полный текст и комментарии »

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

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

This is in regard with Codeforces Round #660-Div 2 Problem B. I submitted a solution to this problem in O(n) time complexity. It passed all the pretests but gave TLE in system testing but later during practice the same code was accepted.

Solution submitted during contest: https://mirror.codeforces.com/contest/1388/submission/88486803 gave TLE.

Solution submitted for practice: https://mirror.codeforces.com/contest/1388/submission/88530257 passed all the test cases.

Can anyone explain me why it happened? Thanks in advance!

Полный текст и комментарии »

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