Codechef SnackDown 2019 Question #1



I’m newbie to competitive programming, so tried to solve this question, I’ve write my solution, and also verified my code on custom inputs, they all worked for me.

But while submitted my solution it’s giving me ‘Wrong Answer’, which mean I know my code has failed with some test cases, But the problem is I coudn’t find any wrong with my solution, Can someone please point out that? Which will help me to learn more.

Here is my Solution :


Here’s an input for which your code fails

10 2
1 9 6 3 6 6 2 9 2 3

Expected Output: 2

Your Output: 5 (link)


Why It’s 2, I think after sorting input 9,9,6,6,6,3,3,2,2,1 and here K=2 means # of teams which has 2nd rank, so it’s 9,9,6,6,6 and this is total = 5

Can you explain why it’s 2?


Team #1: 9
Team #2: 9
That’s all.


Ohhh my bad, I got understand question in slight wrong way. However I’ve not passed any question in this Qualifier Round, So Am I out of this SnackDown 2019 or have chance for another next “SnackDown 2019 - Online Round 1A” ?


The qualification criteria was to solve at least one question, if you didn’t manage to solve any questions then I’m afraid you are out of SnackDown 2019. That’s okay, when you are just beginning competitive programming, such things happen.