Poor test Cases in MFREQ

Extremely Poor test cases for problem MFREQ problem on February Long Contest. I checked many of the solutions that get accepted for 100 points but almost all of them fails for simple test case :

5 1

2 2 3 2 2

1 5 3

here the output should be 2, but many of the accepted solutions give output -1, and its actually because of the position of 3 in the test case

If we change test case to

5 1

3 2 2 2 2

1 5 3

simply change the position of 3 and everyone give output 2.

Actually it’s because many of the solutions are depends on the middle value of the range.

I think codechef should really do some serious work on making proper testcases, as it is happening most frequently nowadays.

ps : Any suggestion, comment or advice, or any type of correction is most welcomed.

For each query, you have to find an element which occurs consecutively in the subarray [L,R] more than or equal to k times

In first test case-

    5 1
2 2 3 2 2
1 5 3

I don’t see 2 occurring consecutively 3 times…

    5 1
3 2 2 2 2
1 5 3

2 is correct here, but NOT in previous.

Question said occurring CONSECUTIVELY!!!

Read the question carefully dear, these are things which give people sleepless nights of “Why is my code not working” !!!

But anyways, I hope the query is resolved, get back to me in case of any discrepancy :slight_smile:

3 Likes

I think you have overlooked something in the problem statement. The problem statement says-
“…For each query, you have to find an element which occurs CONSECUTIVELY in the subarray [L,R] more than or equal to k times…”
The test cases and the solutions which have got AC are quite correct.

3 Likes

The problem statement says the elements must occur consecutively and does not ask for the total number of occurrences.

1 Like

The output for the 1st test case given by you is -1 because there is no element which occurs greater than or equal to 3 times consecutively and, the output for 2nd test case is correctly 2 because 2 occurs greater than or equal to 3 times consecutively. It seems you didn’t read the word consecutively in the question. Just go through the question again. Cheers ! :slight_smile:

1 Like

BTW, don’t take it in wrong way guys, one funny thing which I must say is that- OP did made his point of test cases being weak…he got 40 points with this approach :stuck_out_tongue:

1 Like

Sorry Everyone… You all are right… I really missed that word consecutively and thanks for your comment.

Lucky guy . But yes I agree when you get the small cases right You hope that your logic is correct and you need some small tweaks to get it correct for larger ones.

But all said and done the people at codechef work really hard but small things like this manage to sneak through even after that much amount of checking and testing.

1 Like

yes there is consecutive in the statement.

1 Like

Please be sure before pointing out any mistake in question of codechef own contests. It’s long contest and i am sure that at every stage they rectify each and every situation or test cases before organizing their own contest. It’s not a good act to point such a mistake in public and blame the author of these contest.

1 Like

really sorry bro… but the point is how I get subtask to be accepted even with this wrong approach is really something to be taken into consideration…

1 Like

Not a big deal, happens to everyone. But it IS strange that the test cases are weak enough to let you get 40 :slight_smile:

3 Likes

@vijju123, that’s true :stuck_out_tongue:
It’s an honest mistake, he thought he got 40 points so he had at least understood the question correctly.

1 Like

@chandyshot

The smaller subtasks, as I personally believe, implement a system of partial marking to encourage other people (of slower algo, a bit unrefined logic) to keep trying and improve further. (I mean, its better seeing that “Oh! I did the problem 30% but rest of cases are giving TLE…” . It kinda gives you a feel that you have done SOMETHING with your efforts and your efforts till now aren’t in vain.)

That said, its natural that they are a bit lenient. I mean, sometimes problem setters purposely give easy test cases in sub tasks of ~5,10 or 20 points so that people attempting with a bit of right logic GET something.

Don’t misinterpret it! What they do is that they give easier test cases (eg- little value of constraints ) so that codes, which are in right direction, get benefit of partial marking.

Your code was in right direction, but of course, you missed the “consecutively” part. I will call it leniency of problem setter rather than weak test case, cause as @bansal pointed out, they check their test cases and statement numerous time, and do not hesitate to correct it even if its up in the contest (I mean, I don’t encourage this practice cause problem once published in contest, should be free of errors, but it takes guts to accept the errors and correct it - knowing people will criticize you for not posting correct problem in first place)

That being said, the real show is in passing the final sub task of these problems, which sometimes make you pull your hair out on “MY PROGRAM PASSES FIRST 3 SUB TASK BUT WHY IS IT FAILING ONLY IN FINAL SUB TASK? AND WHY IS FINAL SUB TASK HAVING 75 MARKS WHILE FIRST 3 HAVE ONLY 25…”

(PS: :stuck_out_tongue: . I guess that’s the reason final sub task has most weightage :stuck_out_tongue: )

Please see- The above are my PERSONAL beliefs, purely based on my own experiences. I have no experience of setting problems or something, and what I said above is purely based on my experience in competitive programming as a contestant.

2 Likes

True. While I do expect the logic getting some points, 40 is quite lenient :3

(Side note- why do I never get so lucky in contests T_T :_( XD)

Really sorry… I misunderstood the question…

1 Like

Dun worry, I am not pointing you out buddy! I am just trying to share my PoV. And to be honest, I appreciate the fact that you don’t hesitate to apologize.:-).

I think the test cases for smaller subtasks are delibrately made easy sometimes.

So that more people can get points in smaller subtasks.

1 Like