https://www.codechef.com/viewsolution/29266378
Please tell me what’s the error
The solution you posted is AC (?)
Do you mean this: CodeChef: Practical coding for everyone ?
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
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