Lunchtime CATFEED, solved the problem got correct answers for input but on submit shows wrong answer

I am getting correct answers for any input but on submitting it shows wrong answer can anyone help me to find out where is the problem in the code…
code link - CodeChef: Practical coding for everyone

brief about my logic -
i divided the a[m] array into parts where each part is of n(no. of cats) units,
and checked if any value is repeated in a part if repeated i printed no
else printed yes…

1 Like

What if n= 5 and m=3 and array is 1 3 3? It will be a fair sequence

1 Like

https://www.codechef.com/viewsolution/26841791
can you tell me which testcase am i missing or is this approach totaly wrong?

finally i got it tnx to aditya… :smiley:

1 Like

can you explain please i am not getting…

Check for this test case:
1
2 8
1 2 1 1 2 3 1 2 3
Your code gives “YES”…
While it’s answer in “NO”
The error is in 18th line where you check
a[j]==a[j+1]
It check the 2nd and 3rd position but not the 1st and 3rd position
Hope you understand…