Impressing the judge is hard!

I wrote a python 3.6 code for this problem. The solution is here.

My idea is to take input, calculate the lead and update it onto a dictionary as a key with value 1 or 2, depending on who had more points. Also I side by side made a list for all the leads and using python’s sort method, found the maximum element.
Then I used the dictionary get method to figure out who won.
Not sure where I went wrong…

Not hard if you understand the question.
leads will be calculated using cumulative scores.
so you need to add the previous scores in calculating the lead.
Here is your correct solution
https://www.codechef.com/viewsolution/39064989

Your solution can be more simple, like this
https://www.codechef.com/viewsolution/39064845

2 Likes

Wait, I get what you are doing
You are finding the scores of both players at any time ,then calculating the lead and not separate lead for each round. But in the problem, the example was not like this.

Could you possibly point out what I am missing??

By the way thanks for fixing my solution. :yum:

Look at both the tables carefully, in table 1 scores are given for each round, and in table 2 lead is calculated using total scores (cumulative scores). Input is table 1.