WRONG ANSWER IN THE LEAD GAME

#include <stdio.h>
int main()
{
int t,a,b,gd=0;
int winner;
scanf("%d",&t);
for (int i=0;i<t;i++)
{
scanf("%d %d", &a , &b);
if(a-b>gd)
{
gd=a-b;
winner=1;
}
else if(b-a>gd)
{
gd=b-a;
winner=2;
}}
printf("%d %d",winner,gd);
}

You’re only considering the scores for each round, not the cumulative scores from this and all previous rounds.

1 Like