https://www.codechef.com/problems/TLG

my code is passing all the test cases and is running without any error. whats wrong in this , why its not accepting the solution pls help.

#include
using namespace std;

int main() {
int t,m=0,w;
cin>>t;
while(t>0){
int a,b;
cin>> a >> b;
if(a>b&&m<(a-b))
{
m=a-b;
w=1;
}
else
{
if(b>a&&m<(b-a))
{
m=b-a;
w=2;
}
else
break;
}
t–;

}
cout<<w<<" "<<m;
return 0;

}

you are just comparing the scores at every round while in question scores are added at each round and then the winner and lead is calculated.
Try with cumulative socres.