Lead Game: HELP..!!

I am always getting a WA but code is working for given inputs.
Link to my solution-> http://www.codechef.com/viewsolution/5161734

Brother, let me try to explain the problem statement to you.
The trick in the problem is that at each round previous scores are added as well, so lead is calculated for the scores and it is very much clearly depicted in the problem statement.

Let me explain you with the test case given :

Round   Player 1    Player 2

  1       140          82
  2        89         134 
  3        90         110 
  4       112         106
  5        88          90

so after round 1 player 1 scores 140 and player 2 scores 82.
So lead is 140-82 i.e. 58 and leader is 1.
In round 2 player 1 scores 89 and player 2 scores 134.
So according to your solution, in this round player 2 is leader and lead equals to 134-89 = 45.
But actually till now the total scores are 229 and 216 for player one and two respectively.
So player 1 is still leading but his lead has been curtailed to just 13. so we need to consider this lead not the individual round difference.

Just include this and you will get accepted. Hope you got it.

6 Likes