What is test case made my solution to this problem fail?

problem
https://www.codechef.com/LTIME86B/problems/CHECHOC/
my solution
https://www.codechef.com/viewsolution/35966594

any help

Didn’t look at your code but try
1 1 5 4 ->ans 5
4 4 4 100 ->ans 64

1 Like

same bro
corner case. for n==1 and m==1 ans is X

1 Like

first test not correct
second correct
but i change code to handle corner case n==1 ,m==1
but still give me wrong answer

handle it but still give me wrong answer

try for
1
3 5 8 11
ans - 85

1 Like

and
1
3 3 5 7
ans- 33

1 Like

two testcases correct

I didn’t saw your code but try the below test case. It failed once in my answer.
2
1 5 9 2
5 1 2 9
ans
6
10
try some other testcases where some elements may go -ve if we calculate nextelement = y-currentelement.

1 Like

I spent all contest time for this problem trying testcases but cannot get wrong answer

It is giving AC after adding n=1 & m=1 case