Is this a Bug?

How this solution got an AC? This is supposed to get a WA. I read the problem carefully.
Can you guys please tell me how this solution get an AC?

Problem link:
Submission link:

Notice: I wondered that he got an AC during the contest. It is a problem of C Cube contest on CC. I tried this code after the contest end. But I got a WA, then how he got an AC during the contest?

Maybe they added strong test cases after the contest

Yes, The test Cases were weak and the approach regarding AC was not accurate…

1 Like

Sometimes after the contest ends and if the test cases are too weak then additional test cases will be added before adding that problem in the practice section


Totally Agree with you…

It’s literally a randomized solution, with nothing else in it. So why is it surprising that it worked once, but is not working later?
It probably happened that when he submitted during the contest, the random numbers worked in his favor. If you submit if enough times now, you should probably also get an AC now.
[Not defending the problem - it obviously has super weak data if this solution had any non-trivial chance of passing]


Are you saying that this solution passed one in a million? I mean there’s 50% of first answer to be right…and so on and so forth so the chance of it being right must be very low right?

I think who he got an AC, he is lucky.

By any chance, do you know the number of test cases.

They normally tell setters to avoid multiple test cases, especially for easy problems.
I wouldn’t be too surprised if there were 5 or 6.
Oh well:

He is not lucky, problem is very weak. Its setters mistake.
PS: I hope you know codechef do not verify if test cases are strong enough for external unrated contests.