Overflow(help)

https://www.codechef.com/problems/FORESTGA
Getting WA, might be due to integer overflow, how i can fix it?
https://www.codechef.com/viewsolution/24966642

you could maybe return 1, if you have total_cuts>=w while in the loop(ok function), that could help with overflow issue.

Few updates:

1.) do what I said above.
2.) I tried to do this problem, here’s my solution: https://www.codechef.com/viewsolution/24968118
I think where your code gives WA, is we need to give minimum months for the result, and if l and r and close, you are giving r as the answer, try to run the loop till they equal, and print low.

here’s the Accepted solution, using your code: https://www.codechef.com/viewsolution/24968136

1 Like

Btw whats wrong with this
https://www.codechef.com/viewsolution/24968423
Its giving WA in one test case only.

make l=0, initially.

1 Like