ANSLEAK April Long Challenge

My approach was to count the occurrence of same answers and then print the answers with maximum occurrence.
My code: CodeChef: Practical coding for everyone

Can anyone suggest a better approach.

I did that too but got TLE in python

Did u try anything else?

I checked maximum occurrence of each un-visited element while maintaining an array of k positions.
Link to my code :
https://www.codechef.com/viewsolution/31593135

Actually i tried to make a score generating function then tried different approaches and print the array of max score but that code wasn’t working so i gave up on that

In another solution, I just printed a random choice from the list of correct answers. So indirectly the one answer with high frequency “may” have been selected.

An even easier solution is to choose answer 1 to every question, for 37 points. This must be the easiest way of getting points in the contest, which I am surprised many did not see.

I think that the scoring system was wrong, to give so many points to such a simple solution. It should have been something like the present scoring system to the 4th power, so that this solution would earn only about 1 point.

I did that first, storing the number of correct answers to each form (which I call K-counts).

Sort the forms by the number of correct answers. The ‘score’ is then the number of correct answers to the first item in the sorted list.

Then loop the following, until there is no further improvement or we have changed half the answers:

Identify the question whose answer is to be changed to increase low k-counts:

    // Choose a question which has not been changed already, and
    // where (a) the answer in the form with the lowest K-count
    // is different from the existing answer to question N, and (b) the answer in the form
    // with the next lowest K-count is different from the existing answer to question N,
    // and (c) the answers in these 2 forms is the same, and (d) the answer in the form
    // with the next lowest K-count is different from the existing answer to question N.
    // If not all these conditions can be satisfied, choose what we can.
    // If none can be satisfied, return -1 (to exit the loop)
    // Insert it into list of n_changed, keeping list in order

Change the answer to this question to that supplied for this question on the form with the lowest K-counts.

Sort the K-counts.

If the score (the number of correct answers to the form with the lowest K-count) is getting worse, exit from the loop.

Go round again!

This solution gained me 80 points. You can see it at CodeChef: Practical coding for everyone

What I did is to choose the answer of ith question from the set which has minimum number of correct answers choosen as of the ith question.
Link to my answer : CodeChef: Practical coding for everyone