# The outputs are correct, still my solution is partially correct. Could anyone tell me what is partially wrong in my code?

Problem Link:

Solution Link:
https://www.codechef.com/viewsolution/32891596

Can you explain your logic? I don’t understand what any of your code is doing.

I second @galencolin. I don’t understand your code either.
You can create an array of length 8 (since 9, 10 and 11 don’t matter). Initialize all values to 0. I will denote the problem number with `p` and score with `s`.
If `p > 8`, don’t do anything. Else `array[p-1] = max(array[p-1], s)` (Assumung 0-based indexing).
`total = 0`
`total += sum(array)`
Then all you need to do is `print(total)`

@galencolin @anon53253486
It takes the first problem number§ and compares it to the other problem numbers entered.
If the index of the list ‘stats’ in the second 'for loop ’ is 0 (k == l) then y is added to the score as long as the problem number§ is between 1 to 8. After the 0th index, if the remaining question numbers are between 9 to 11, their scores are not added.

If the problem number is between 1 to 8, it first checks if the question number is same as the 0th index§. If it is, then it compares the scores of the two and stores the maximum in the ‘score’ variable. If the question number encountered is not the same as the 0th index§, then it just stores the score of the question in the ‘score’ variable.