I have been getting a wrong answer for the question and I have tried many test cases,but no luck.
Any help would be much appreciated.Here’s my code :
#include <stdio.h>
int main()
{
int a[10000],b[10000],lead[10000],modlead[10000],n,k,i,j,max,loc=1;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
scanf("%d",&b[i]);
lead[i]=a[i]-b[i];
if(lead[i]<0)
modlead[i] = lead[i]*-1;
else
modlead[i]=lead[i];
max=modlead[0];
}
for(i=0;i<n;i++)
{
if(modlead[i]>max)
{
max=modlead[i];
loc=i+1;
}
}
if(lead[loc]<0)
printf("\n 1 %d",max);
else
printf("\n 2 %d",max);
return 0;
}