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
interger overflow is taking place which makes the while loop eternal. Use long long variables
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.