Gordon-Freeman's blog

By Gordon-Freeman, history, 2 hours ago, In English

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

  • Vote: I like it
  • +3
  • Vote: I do not like it

»
113 minutes ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
14 minutes ago, # |
  Vote: I like it 0 Vote: I do not like it

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.