### Yasuho_Hirose's blog

By Yasuho_Hirose, history, 4 months ago,

here is my solution: https://codeforces.com/contest/1624/submission/144304382 for this problem: https://codeforces.com/contest/1624/problem/E I think time complexity of this solution is O(n*m) is small enough, but why this still give TLE? Thanks you for read my shi* blog.

• -10

 » 4 months ago, # |   0 probably because of using memset for every testcase. memset(t2,0,sizeof(t2)); with 10000 testcases and t2 of the size 1000, this TLEs
•  » » 4 months ago, # ^ | ← Rev. 2 →   0 i think this is not problem, because time complexity of memset is o(n), and t1, t2 just 100 and 1000 elements. I think this give tle when assign dp[i-2] or dp[i-3] to dp[i], i got accepted now. Anw, thank you so much.
 » 4 months ago, # |   0 OhI often suffer from this problem also.The reason of you getting TLE is because you code's runtime is longer than the time limit (i.e. 3 seconds)What you should do is to code a code with a shorter runtime which is shorter than the time limit.But then how do you know if the new code have a runtime shorter than the time limit or not?You can then simply submit your code to the online judge (i.e. codeforces) to the corresponding question.If your code have a runtime shorter than the time limit, codeforces will return a green, “Accepted" word.but then if your code have a longer runtime than the time limit, codeforce will return a blue,"Time Limit Exceeded on Test XX" where XX is a number.Hope this will help.
•  » » 4 months ago, # ^ |   0 thanks, i got it