Just now I finish the Codeforces Global Round 7 D2 by look at Tutorial, but I found that the different place of variable caused time cost different.
Here is the AC submit and TLE submit. The only difference is line 24 in ac submit and line 25 in TLE submit. Can anyone tell me something about it ? Thanks in advance.









Honest question, what do you think the difference is between these two snippets?
vs
One will allocate a new array every time
f(...)is called, the other one won't. You can get similar behavior as the global variable by doingstatic int a[1024].