Why is it giving AC

I was looking into other user’s solution and then I found this solution


this solution gives
yes for
6 2
1 2 3 5 4 6
but the correct answer is no then how did this solution get AC or I am missing something?


No,you are right,it’s because of weak test cases!!

1 Like

what!!! . maan , this test case is so basic .
didn’t expect this type of carelessness from codechef

1 Like

Many of the contest problems on codechef have very weak testcases. This happened with me in the previous contest - Cookoff April 20. For the 3rd problem - MINOPS, I submitted 2 solutions that give different answers for a testcase. Yet both of those solutions were accepted!

1 Like

Thanks for reporting. We’ll look into it and add the testcase to the Practice contest.

1 Like

what is the use?
same thing happened for POSITIVE MEX problem as well
if test cases are good only in practice section and not in contests…
then better there are only practice problems

I saw a submission for the TRIQRY which was simple brute force and was accepted. But when I tried to submit the same code ,I got TLE.
Were the test case changed during the contest??

Test cases never change during a contest. And secondly, how can you see someone else’s answer in the middle of the contest. Please enlighten all of us here.

I saw the submission after the contest ended.

Ohh, then thats okay. I misinterpreted what you said. Sorry.

If anyone can see my solution please suggest me if it went wrong in any test case CodeChef: Practical coding for everyone

@anon38910692, bro your logic is correct but its worst case time complexity is O(n^2) for the cases like 5,4,3,2,1 and k = 1. so it should get rejected by TLE

@admin , please add this test case too.

Thanks bro! I had a doubt that why it was accepted n^2 complexity though I am happy my logic was correct.

can you share the test case please??

Please check out this post. Here i’ve explained in detail the difference between the solutions and the particular testcase that gets different answers from the two different solutions.