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://codeforces.net/contest/1388/submission/88486803 gave TLE.
Solution submitted for practice: https://codeforces.net/contest/1388/submission/88530257 passed all the test cases.
Can anyone explain me why it happened? Thanks in advance!