Wrong test data in MFREQ

I’m 99% sure that the test cases for the problem MFREQ in the current contest are faulty.

To be more precise, I think that the author’s and tester’s solutions will print elements that appear exactly k times consecutively in the array [L, R] for each query, whereas the description says to output -1, and print the element only if they appear more than k times.

I think this is the case because I wrote a simple brute force solution and it gets AC with >= but WA with >.

This is also why the problem has such a low accuracy and a relatively low amount of successful submissions.

EDIT: Description was fixed.


I think you are right.
I tried it with >= and got AC.

Actually, I just noticed that they have modified the statement. Previously, we have to print element that appears more than K times, but now it has become >=k times. They have not mention changes in the announcement section. So it has created confusion. Hope it helps! :slight_smile:

1 Like

This is such a intolerable act that codechef perform everytime. They always changed test case or part of question without notifying or announcement.

I am really disappointed from This act.

tell me one thing do we have to check first that whether k is greater than floor((r-l+1)/2) or not???

and if we have to check it then what to to print on console if k is not greater than this value??


See the constraint first.

That was REALLY not appreciated. I think they were in a haste to get new problems and stuff…but its still not justified to change description and not announce.

(PS: Why do I get a feeling that they looked at discussion forum and then fixed it? IDK I just get it…)

They didn’t change the test cases, I don’t think, just fixed the description.

But still I’m sure that there are people who gave up on the problem because they kept getting WA with correct algorithms, and now they won’t notice the change in the description because it wasn’t announced.


Fixed. Thanks :slight_smile:

You don’t have to check this. It is guaranteed that k>floor((r+l-1)/2).

What should we print if we have multiple answers for single query?

For example:-

6 1

2 2 2 3 3 3

1 6 3

2 or 3?

Please don’t spam here. There is a separate section of comment given below at the question, where you can ask your query directly with author.

I noticed this error in the question when I solved it. I did mention the correction in the Comments section, when there was still no update after one day. They seem to have updated the problem statement now, however, they should have mentioned such a change in the Announcements section.