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

Автор Ansh_jain, история, 5 лет назад, По-английски

In yesterday's codeforces round 636(Div 3.)

https://codeforces.net/contest/1343/submission/77564353 This is my solution for D which I submitted during contest. It gave me TLE in system testing on TC11. Now i copied exactly the same code and submitted it after the contest(and after the system testing) https://codeforces.net/contest/1343/submission/77619357. This is the link for the same. It is Accepted by the system. moreover i have submiited the same code 3 -4 times after contest it is showing AC every time. Now can somoene please explain to me why is all this happening and if my code is AC will i get marks for it?? Plz someone if have any idea why this is happening reply

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

»
5 лет назад, # |
Rev. 2   Проголосовать: нравится +9 Проголосовать: не нравится

for your last submission (530 ms) you are reading int instead of long long int
this explains the difference in time execution (-400ms) reading int is faster than long long int
for the other ones (997ms,983ms, and +1000 ms) I think +- 50 ms is normal between the same code
To improve your code try to put freq array as a global variable and reset the first k elements in each
test case instead of 4e5 ( I got 171 ms here is my submission using your code)