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

Автор connorwang38, история, 4 года назад, По-английски

I was wondering if there was a simple way to exit a program in case the time limit would be exceeded. Often times I might accidentally created an infinite loop, miscalculate time complexity, etc. and my computer freezes up where I have to reboot. Seems as though there should be easy solutions to this, but I couldn’t find any. Thanks in advance!

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

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

Use CpEditor. Default TLE at 5 seconds.

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

Although I don't need to restart my computer even if I write a infinite loop, you can always use this in ubuntu :

timeout "time in seconds" ./executable < in

  • If you use vs code then edit your tasks.json file to accommodate the above command.
  • Not sure about other editors.