Please help me with TLG problem

https://www.codechef.com/viewsolution/55674285
I don’t know where I’m wrong even though I’m getting the right answers including constraints.
please help!!!
@ssjgz

You are not adding the previous scores (means you are not calculating the cumulative scores) every time you are taking new values of aa and bb, but you have to add the previous values of aa and bb also and then calculate difference.

    scanf("%d", &t);
    int aa=0, bb=0;
    while (t--)
    {
        int new_aa = 0, new_bb = 0, c = 0;
        scanf("%d", &new_aa);
        scanf("%d", &new_bb);
        aa+=new_aa;
        bb+=new_bb;

        if(aa>bb){     ////     }


2 Likes

I think you have to add the scores of each player to find the winner then you can continue with finding the lead
{ First player total score, secondplayer totalscore And winners lead}

1 Like