Language: C++



#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define llu unsigned long long
#define ld double
#define llu unsigned long long
#define rep(i,x,y)  for(ll i=(ll)(x);i<(ll)(y);++i)
#define For(i,x,y)  for(ll i=(ll)(x);i<=(ll)(y);++i)
#define FOr(i,x,y)  for(ll i=(ll)(x);i>=(ll)(y);--i)
#define pi acos(-1) 
#define mk make_pair
#define pa pair<ll,ll>
#define lf else if
#define IL inline
#define max(x,y)    ((x)<(y)?(y):(x))
#define min(x,y)    ((x)<(y)?(x):(y))
#define sqr(x)      ((x)*(x))
#define Mul(x,y)    ((x)=1LL*(x)*(y)%mod)
#define Add(x,y)    ((x)=((x)+(y))%mod)
#define E(x)        return writeln(x),0
#define LL			(long long)
#define p(x)        printf("~%lld~\n",LL(x))
#define pp(x,y)     printf("~~%lld %lld~~\n",LL(x),LL(y))
#define ppp(x,y,z)  printf("~~~%lld %lld %lld~~~\n",LL(x),LL(y),LL(z))
#define pppp(a,b,c,d)	printf("~~~%lld %lld %lld %lld\n",LL(a),LL(b),LL(c),LL(d))
#define f_in(x)     freopen(x".in","r",stdin)
#define f_out(x)    freopen(x".out","w",stdout)
#define open(x)     f_in(x),f_out(x)
#define fi first
#define se second
#define GuYue		puts("\nGuYueNa________________________________________________________________________________")
#define y1			fafa____
typedef complex<double> E;
namespace SHENZHEBEI{
#ifdef LOCAL
    struct _{_(){freopen("cf.in","r",stdin);}}_; 
#endif 
#define NEG 1
    static const int GYN=2333333;
    char SZB[GYN],*S=SZB,*T=SZB;
    inline char gc(){   if (S==T){  T=(S=SZB)+fread(SZB,1,GYN,stdin); if (S==T) return '\n';  }   return *S++;    }
#if NEG
    inline ll read(){    ll x=0,g=1; char ch=gc();   for (;!isdigit(ch);ch=gc()) if (ch=='-') g=-1;  for (;isdigit(ch);ch=gc())  x=x*10-48+ch;   return x*g; }
    inline void write(ll x){    if (x<0) putchar('-'),x=-x;  if (x>=10)   write(x/10);    putchar(x%10+'0');  }
#else
    inline ll read(){    ll x=0; char ch=gc();   for (;!isdigit(ch);ch=gc());    for (;isdigit(ch);ch=gc())  x=x*10-48+ch;   return x;   }
    inline void write(ll x){    if (x>=10)   write(x/10);    putchar(x%10+'0');  }
#endif
    inline char readchar(){ char ch=gc();   for(;isspace(ch);ch=gc());  return ch;  }
    inline ll readstr(char *s){ char ch=gc();   int cur=0;  for(;isspace(ch);ch=gc());      for(;!isspace(ch);ch=gc())  s[cur++]=ch;    s[cur]='\0';    return cur; }
	void Print(long long *a,int s,int t){For(i,s,t)printf("%lld ",a[i]);puts("");}
	void Print(int *a,int s,int t){For(i,s,t)printf("%d ",a[i]);puts("");}
	void Print(char *a,int s,int t){For(i,s,t)putchar(a[i]);puts("");}
	void writeln(ll x){write(x);putchar('\n');}
}using namespace SHENZHEBEI;
void build(ll l,ll r,ll &p){
	if (l==r){
		p=id[l];	mn[p]=mx[p]=a[l];
		return;
	}p=++cnt;
	ll mid=(l+r)>>1;
	build(l,mid,ls[p]);
	build(mid+1,r,rs[p]);
	g[p].push_back(ls[p]);
	g[p].push_back(rs[p]);
	mx[p]=max(mx[ls[p]],mx[rs[p]]);
	mn[p]=min(mn[ls[p]],mn[rs[p]]);
}
bool check(ll len){
	cnt=n*2;
	For(i,1,n)	a[i]=x[i],id[i]=i+n;
	build(1,n,Rt);
	For(i,1,n)AddEdge(x[i]-len,x[i]+len,i);

	For(i,1,n)	a[i]=y[i],id[i]=i;
	build(1,n,1);
	For(i,1,n)AddEdge(y[i]-len,y[i]+len,i+n);

}
int main(){
	n=read();For(i,1,n)x[i]=read(),y[i]=read(),q1[++top1]=x[i],q2[++top2]=y[i];
	sort(q1+1,q1+top1+1);sort(q2+1,q2+top2+1);
	For(i,1,n)	x[i]=lower_bound(q1+1,q1+top1+1,x[i])-q1,
				y[i]=lower_bound(q2+1,q2+top2+1,y[i])-q2;
	ll l=0,r=2e9,mid;
	for(;l<=r;){
		mid=(l+r)/2;
		if (check(mid))ans=mid,l=mid+1;
		else	r=mid-1;
	}writeln(ans);
}

Compiler output:
a.cc: In function 'void build(long long int, long long int, long long int&)':
a.cc:60:19: error: 'id' was not declared in this scope; did you mean 'ld'?
   60 |                 p=id[l];        mn[p]=mx[p]=a[l];
      |                   ^~
      |                   ld
a.cc:60:33: error: 'mn' was not declared in this scope; did you mean 'yn'?
   60 |                 p=id[l];        mn[p]=mx[p]=a[l];
      |                                 ^~
      |                                 yn
a.cc:60:39: error: 'mx' was not declared in this scope; did you mean 'max'?
   60 |                 p=id[l];        mn[p]=mx[p]=a[l];
      |                                       ^~
      |                                       max
a.cc:60:45: error: 'a' was not declared in this scope
   60 |                 p=id[l];        mn[p]=mx[p]=a[l];
      |                                             ^
a.cc:62:14: error: 'cnt' was not declared in this scope; did you mean 'int'?
   62 |         }p=++cnt;
      |              ^~~
      |              int
a.cc:64:21: error: 'ls' was not declared in this scope; did you mean 'l'?
   64 |         build(l,mid,ls[p]);
      |                     ^~
      |                     l
a.cc:65:23: error: 'rs' was not declared in this scope; did you mean 'r'?
   65 |         build(mid+1,r,rs[p]);
      |                       ^~
      |                       r
a.cc:66:9: error: 'g' was not declared in this scope
   66 |         g[p].push_back(ls[p]);
      |         ^
a.cc:68:9: error: 'mx' was not declared in this scope; did you mean 'max'?
   68 |         mx[p]=max(mx[ls[p]],mx[rs[p]]);
      |         ^~
      |         max
a.cc:69:9: error: 'mn' was not declared in this scope; did you mean 'yn'?
   69 |         mn[p]=min(mn[ls[p]],mn[rs[p]]);
      |         ^~
      |         yn
a.cc: In function 'bool check(long long int)':
a.cc:72:9: error: 'cnt' was not declared in this scope; did you mean 'int'?
   72 |         cnt=n*2;
      |         ^~~
      |         int
a.cc:72:13: error: 'n' was not declared in this scope; did you mean 'yn'?
   72 |         cnt=n*2;
      |             ^
      |             yn
a.cc:73:25: error: 'a' was not declared in this scope
   73 |         For(i,1,n)      a[i]=x[i],id[i]=i+n;
      |                         ^
a.cc:73:30: error: 'x' was not declared in this scope
   73 |         For(i,1,n)      a[i]=x[i],id[i]=i+n;
      |                              ^
a.cc:73:35: error: 'id' was not declared in this scope; did you mean 'i'?
   73 |         For(i,1,n)      a[i]=x[i],id[i]=i+n;
      |                                   ^~
      |                                   i
a.cc:74:19: error: 'Rt' was not declared in this scope
   74 |         build(1,n,Rt);
      |                   ^~
a.cc:75:27: error: 'x' was not declared in this scope
   75 |         For(i,1,n)AddEdge(x[i]-len,x[i]+len,i);
      |                           ^
a.cc:75:19: error: 'AddEdge' was not declared in this scope
   75 |         For(i,1,n)AddEdge(x[i]-len,x[i]+len,i);
      |                   ^~~~~~~
a.cc:77:25: error: 'a' was not declared in this scope
   77 |         For(i,1,n)      a[i]=y[i],id[i]=i;
      |                         ^
a.cc:77:30: error: 'y' was not declared in this scope
   77 |         For(i,1,n)      a[i]=y[i],id[i]=i;
      |                              ^
a.cc:77:35: error: 'id' was not declared in this scope; did you mean 'i'?
   77 |         For(i,1,n)      a[i]=y[i],id[i]=i;
      |                                   ^~
      |                                   i
a.cc:79:27: error: 'y' was not declared in this scope
   79 |         For(i,1,n)AddEdge(y[i]-len,y[i]+len,i+n);
      |                           ^
a.cc:79:19: error: 'AddEdge' was not declared in this scope
   79 |         For(i,1,n)AddEdge(y[i]-len,y[i]+len,i+n);
      |                   ^~~~~~~
a.cc:81:1: warning: no return statement in function returning non-void [-Wreturn-type]
   81 | }
      | ^
a.cc: In function 'int main()':
a.cc:83:9: error: 'n' was not declared in this scope; did you mean 'yn'?
   83 |         n=read();For(i,1,n)x[i]=read(),y[i]=read(),q1[++top1]=x[i],q2[++top2]=y[i];
      |         ^
      |         yn
a.cc:83:28: error: 'x' was not declared in this scope
   83 |         n=read();For(i,1,n)x[i]=read(),y[i]=read(),q1[++top1]=x[i],q2[++top2]=y[i];
      |                            ^
a.cc:83:40: error: 'y' was not declared in this scope
   83 |         n=read();For(i,1,n)x[i]=read(),y[i]=read(),q1[++top1]=x[i],q2[++top2]=y[i];
      |                                        ^
a.cc:83:52: error: 'q1' was not declared in this scope; did you mean 'y1'?
   83 |         n=read();For(i,1,n)x[i]=read(),y[i]=read(),q1[++top1]=x[i],q2[++top2]=y[i];
      |                                                    ^~
      |                                                    y1
a.cc:83:57: error: 'top1' was not declared in this scope
   83 |         n=read();For(i,1,n)x[i]=read(),y[i]=read(),q1[++top1]=x[i],q2[++top2]=y[i];
      |                                                         ^~~~
a.cc:83:68: error: 'q2' was not declared in this scope
   83 |         n=read();For(i,1,n)x[i]=read(),y[i]=read(),q1[++top1]=x[i],q2[++top2]=y[i];
      |                                                                    ^~
a.cc:83:73: error: 'top2' was not declared in this scope
   83 |         n=read();For(i,1,n)x[i]=read(),y[i]=read(),q1[++top1]=x[i],q2[++top2]=y[i];
      |                                                                         ^~~~
a.cc:84:14: error: 'q1' was not declared in this scope; did you mean 'y1'?
   84 |         sort(q1+1,q1+top1+1);sort(q2+1,q2+top2+1);
      |              ^~
      |              y1
a.cc:84:22: error: 'top1' was not declared in this scope
   84 |         sort(q1+1,q1+top1+1);sort(q2+1,q2+top2+1);
      |                      ^~~~
a.cc:84:35: error: 'q2' was not declared in this scope
   84 |         sort(q1+1,q1+top1+1);sort(q2+1,q2+top2+1);
      |                                   ^~
a.cc:84:43: error: 'top2' was not declared in this scope
   84 |         sort(q1+1,q1+top1+1);sort(q2+1,q2+top2+1);
      |                                           ^~~~
a.cc:85:25: error: 'x' was not declared in this scope
   85 |         For(i,1,n)      x[i]=lower_bound(q1+1,q1+top1+1,x[i])-q1,
      |                         ^
a.cc:86:33: error: 'y' was not declared in this scope
   86 |                                 y[i]=lower_bound(q2+1,q2+top2+1,y[i])-q2;
      |                                 ^
a.cc:90:32: error: 'ans' was not declared in this scope; did you mean 'abs'?
   90 |                 if (check(mid))ans=mid,l=mid+1;
      |                                ^~~
      |                                abs
a.cc:92:18: error: 'ans' was not declared in this scope; did you mean 'abs'?
   92 |         }writeln(ans);
      |                  ^~~
      |                  abs