The Lead Game | CodeChef


what is problem with my code???plz anyone reply hurry…
#include
#include
#include
using namespace std;

int large(int p,int q){
    if(p>q) return 1;
    if(q>p) return 2;
}

int main() {
int n,p,q;
cin>>n;
int si[n],ti[n],dif[n];
for(int i=0;i<n;i++){
cin>>si[i]>>ti[i];
}
for(int i=0;i<n;i++){
dif[i]=abs(si[i]-ti[i]);
}
int s=sizeof(dif)/sizeof(int);
int a;
a=max_element(dif,dif+s)-dif;
p=si[a],q=ti[a];
cout<<large(p,q);
sort(dif,dif+s,greater());
cout<<" "<<dif[0]<<endl;
return 0;
}

Please either format your code or (better!) link to your submission - the forum software has mangled it and it won’t compile! :slight_smile:

What’s the rush? :slight_smile:

1 Like