WA in CHEFINSQ

https://www.codechef.com/viewsolution/29266378

Please tell me what’s the error

The solution you posted is AC (?)

Do you mean this: https://www.codechef.com/viewsolution/29266378 ?

If so, consider the testcase:

1
20 5
1 3 2 3 2 1 2 1 3 1 1 1 3 1 2 2 1 3 3 2
1 Like

https://www.codechef.com/viewsolution/29268385

It is still not correct even after declaring all variables as int type.

Consider the testcase:

1
50 22
1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 
1 Like

Thank you for your help.
Now it’s AC.

https://www.codechef.com/viewsolution/29269062

2 Likes