Блог пользователя Gordon-Freeman

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

i was watching the tutorial video for the last div2 and after i understood C i submitted its code and it gave TLE even tho its the same code from the vid , so i copyed the code and sent it and it got AC ?? can someone tell me why the previous code gives TLE?

here is the TLE submission: 272356697 and here is the AC submission: 272357045

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

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

interger overflow is taking place which makes the while loop eternal. Use long long variables

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

When you square this number (10^6) it will be 10^12 which is over int limit so you will get negative number.And then it loops so it never escapes the loop. There is your explanation to yours tle.