Ansh_jain's blog

By Ansh_jain, history, 4 years ago, In English

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

https://codeforces.com/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.com/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

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
4 years ago, # |
Rev. 2   Vote: I like it +9 Vote: I do not like it

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)