The lead game: Wrong Answer error. How to verify for which input it's wrong?

#include
using namespace std;

int main(){
long long int n;
int i,j;
cin>>n;
if(n<0 || n>10000)
return 0;
int s[n];
int t[n];
int lead[n];
for(i=0;i<n;i++){
cin>>s[i];
if(s[i]<=0 || s[i]>1000)
return 0;
cin>>t[i];
if(t[i]<=0 || t[i]>1000)
return 0;
if(s[i]>t[i])
lead[i]=s[i]-t[i];
else
lead[i]=t[i]-s[i];
}
int temp=0;
int lead1[n];
for(i=0;i<n;i++)
lead1[i]=lead[i];
for(i=0;i<n;i++){
for(j=0;j<n;j++){
if(lead[i]>lead[j]){
temp=lead[i];
lead[i]=lead[j];
lead[j]=temp;
}
}
}
for(i=0;i<n;i++){
if(lead1[i]==lead[0]){
if(s[i]>t[i])
cout<<"1 "<<lead[0];
else
cout<<"2 "<<lead[0];
break;
}
}
}

1 Like

As the code in question is not readable, I referred this code of yours from submissions.

You should output maximum lead among all the round along with the winner. So print lead[i] or maxlead instead of lead[0].

1 Like

Thank you for your reply. But that was a wrong code I mistakenly submitted which you are referring to.