Wrong Answer error in Lead Game problem

I’m providing you my solution link, this code is working perfectly fine everywhere except CodeChef.
Solution: 45081791 | CodeChef

a) You’re printing out a load of debugging info, or something, so it fails even the sample testcase - your output has to match the expected output exactly! :slight_smile:
b) Once you’ve fixed that: WA for my program (TLG)

The one you linked in your post: CodeChef: Practical coding for everyone

[simon@simon-laptop][08:43:22]
[~/devel/hackerrank/otherpeoples]>./codechef-download-solution.rb https://www.codechef.com/viewsolution/45081791
Solution written to: kr_sarvesh-LEADGAME.py
[simon@simon-laptop][08:43:29]
[~/devel/hackerrank/otherpeoples]>echo "5                                                                       
140 82
89 134
90 110
112 106
88 90" | ./kr_sarvesh-LEADGAME.py
[[140, 82], [89, 134], [90, 110], [112, 106], [88, 90]]
1 58

Sorry my bad, that code was not properly checked. I am giving you the link please check the updated code

Solution: 45084471 | CodeChef

:slight_smile:

you are saying that I should add their scores of each round with their own score of the next round to find the new lead but the question says, at the end of each round the leader and her current lead are calculated. Once all the rounds are over the player who had the maximum lead at the end of any round in the game is declared the winner.
where it is mentioned that i have to carry their previous scores?

The question is not very well explained, but look at the example table where the Lead is calculated.

Got it thanks.

1 Like