I tried this problem without using array just taking input without storing it in a array it gives wrong answer…
https://www.codechef.com/viewsolution/49298408
but when i tried the same problem with storing into array
https://www.codechef.com/viewsolution/49357387
it accepts the solution
why is that…can somebody explain…
ssjgz
3
Edit:
That’s not the only difference between the two solutions.
i dont quite undestand what you r try to say can you please elaborate:
That’s not the only difference between the two solutions.
i just wanted to know that why my first solution didn’t accepted but when using array to store the values it accepted the solution
ssjgz
5
That’s not the only difference between the two solutions.
One solution has this line:
if(water-d<0){
the other has this instead:
if(water-d<=0){
Try running the testcase I gave you through both of your solutions 
1 Like