Изменения рейтингов за последние раунды временно удалены. Скоро они будут возвращены. ×

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

Автор whatthemomooofun1729, история, 3 месяца назад, По-английски

Hi, I was just working on this problem, and I noticed that when I changed my operations from division to addition, it resulted in a huge time difference. With division, my code TLEs, while with addition, my code runs in 400ms (you can see where I changed the code on lines 136 and 142). Division is a more costly operation than addition, but why is it causing such a big difference in runtime? Should we avoid more costly operations to prevent TLE?

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

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

This Wikipedia article should answer the question and it also has some valuable information in a very compact form ! https://en.wikipedia.org/wiki/Computational_complexity_of_mathematical_operations