+ 1

About a submission that i have made in code forces

In the same problem at first I submitted this solution: https://codeforces.com/contest/1620/submission/142528587 then the only thing that I changed is that I included usigned long long int and the results changed drastically why?? second code: https://codeforces.com/contest/1620/submission/142528959

12th Jan 2022, 3:58 PM
Nazeefa Labiba
Nazeefa Labiba - avatar
1 ответ
+ 1
If any of the difference calculations should result in a negative number, then it will cause an underflow in the unsigned version and the max() results will be quite different.
12th Jan 2022, 4:40 PM
Brian
Brian - avatar