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?
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
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?
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: https://www.codechef.com/viewsolution/29910929
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.