Hi, I ran my code in my devc++ compiler and it ran without any problem but when i compile it on codechef, it shows wrong answer. Anyone please help!!!
Here’s my code
#include< iostream >
#include< stdio.h >
using namespace std;
int main()
{
int N,S[10000],T[10000],i,d1=0,d2=0,W,L;
cin>>N;
for(i=0;i<N;i++)
{
scanf("%d %d",&S[i],&T[i]);
if(S[i]>T[i])
{
if((S[i]-T[i])>d1)
d1=S[i]-T[i];
}
else
{
if((T[i]-S[i])>d2)
d2=T[i]-S[i];
}
}
if(d1>d2)
{
W=1;
L=d1;
}
else
{
W=2;
L=d2;
}
cout<<W<<" "<<L;
return 0;
}
If there’s a problem with the logic or if there’s anything I’ve missed out, Please tell me…