I came up with a quite slow solution for Educational Codeforces Round 168 Problem F at the last minute of the contest, and I was unable to implement it on time.
When I tried implementing the solution after the contest, it showed a time limit exceeded verdict on codeforces. 273604133
However, when I test the exact same code and same test on atcoder with the "Custom invocation", it shows that the code only runs in 2155 ms, which is much lower than that of the TL. Can anyone help me with this issue? Thanks.
Auto comment: topic has been updated by tosivanmak (previous revision, new revision, compare).
Auto comment: topic has been updated by tosivanmak (previous revision, new revision, compare).
It's probably because of abuse of long long. I did some optimizations and it fits in time limit. See 273863548. The wrong answer verdict is not my issue.
Will
long long
really slow down programs?It seems that many people have mentioned it. But why?
long long uses more memory which makes it slower. I am not sure if long long will affect the speed of modulo though.
My solution now passes the task. I will be more careful when using long long in the future. Thanks for your help.
If the problem can be reproduced, perhaps CF's judger is really slower.
Perhaps you can check the processor models of CF and Atcoder.
Also, I heard that CF is Windows and Atcoder is Linux, but I'm not sure if there's a difference.
Hoping This Helps.
Then I think cf is probably much slower than that of atcoder, probably need to be more careful with constants when doing cf problems in the future.