Corner cases for The Lead Game

Here’s my C code for the problem, the lead game, though the prob looked highly simple, my code is always rejected with Wrong Solution, I’m quite sure that my code would probably not be able to function in some corner case, thats why this is happening, but could anyone help me with the corner case, ive tried quite a few myself, but that’s no use, its correct everytime, so please help(but please dont tell me the exact error in my code, only the corner case in which it fails, I want to work on it myself)

#include <stdio.h>

int main(void)
    int t, i;
    scanf ("%d\n", &t);
    int A, B, lead = 0, win = 0;
    for (i = 0;i < t;i++)
        scanf("%d %d\n", &A, &B);
        if (A > B && (A - B) > lead)
            lead = (A - B);
            win = 1;
        else if (B > A && (B - A) > lead)
                lead = (B - A);
                win = 2;
       printf ("%d %d\n", win, lead);

    return 0;

There are no corner cases for this question…

For the given testcase, your code may work…but it is not correct.

here you are storing the lead values of each round in the “int lead”

Those lead values are actually not A-B…it is actually

the sum of the scores of the player1 upto the "i"th round - the sum of the scores of the player2 till "i"th round…

so take care of that “int lead”…:slight_smile:

If this helps…hope you can upvote and accept the answer…

All the Best :slight_smile:


Thanks for letting me know, i think im really foolish not to read closely :stuck_out_tongue:

Welcome… :slight_smile: