I have got time limit exceeded in many code. But i do not know how judges calculate the execution time of a code. Can anyone tell me how codeforce calculate the execution time of a code!!!
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
I have got time limit exceeded in many code. But i do not know how judges calculate the execution time of a code. Can anyone tell me how codeforce calculate the execution time of a code!!!
Name |
---|
Hi,
I don't actually know how Codeforces calculate the execution time of code, but here is a simple example (In linux environment), you can use the timeout command and specify the time limit.
If the execution is completed within the time limit (1 second in this case), the programm will exit with the status of COMMAND, otherwise it will exit with status 124.
i am not familiar with Linux environment ...but thanks for your suggestion is there anything for windows programs
I don't think you need to know exactly how Codeforces calculates the execution time of your program to understand the reason why you get the Time Limit Exceeded verdict. Usually, if your program exceeds the TL, that means you are doing something much costlier than necessary and it would not be some extra fractions of seconds that would change the result.