problem with the code in c++

code
problem
with

#1

i have done the chefmover problem with c++ but it is showing WA for one testcase .but when i submiit the same concept in python i got 100 points.can anybody find where i am missing.
my c++ code
https://www.codechef.com/viewsolution/14951850
my python code
https://www.codechef.com/viewsolution/14951721


#2

I think this must be because of overflow. Because it is given that range of Array A is 10^9 but you are taking the input of array in “int”.

int arr[n]; // from your code.

Since python doesn’t overflow easily, that can be one of possible reason.

Hope this helps!


#3

got it .thank you


#4

your welcome brother, please accept the solution if you think it helped!


#5

yeah it got accepted after changing all variables to long long int


#6

@manaranjanfav Sandeep meant that you mark his response as the answer to this question. You can hover onto this answer, you should see the accept answer option,


#7

sorry i accepted the answer