Блог пользователя Pretest

Автор Pretest, история, 8 лет назад, По-английски

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!!!

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
8 лет назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

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.

timeout 1 "your_command_here_to_execute_the_program"

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.

  • »
    »
    8 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    i am not familiar with Linux environment ...but thanks for your suggestion is there anything for windows programs

    • »
      »
      »
      8 лет назад, # ^ |
      Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

      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.