#include <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;
typedef long long ll;
ll n,book[200010];
struct node{
ll x,y;
};
node A[200010];
ll check2(ll x,ll l,ll r){
if((x >= l) && (x <= r)) return 1;
}
void work(ll x,ll y,ll l,ll t){
ll i;
for(i = 1;i <= n;i++){
if((check2(A[i].x,x,x + l)) && (check2(A[i].y,y,y + l))){
if(book[i] == 0) book[i] = t;
}
}
}
void delett(ll x,ll y,ll l,ll t){
ll i;
for(i = 1;i <= n;i++){
if((check2(A[i].x,x,x + l)) && (check2(A[i].y,y,y + l))){
if(book[i] != 0) book[i] = 0;
}
}
}
ll check(ll l,ll t){
ll lef = 1e9,righ = -1e9,upp = 1e9,downn = -1e9,i;
for(i = 1;i <= n;i++){
if(book[i] == 0) continue;
lef = min(lef,A[i].x);
righ = max(righ,A[i].x);
upp = max(upp,A[i].y);
downn = min(downn,A[i].y);
}
if(t == 1){
if((abs(downn - upp) <= l) && (abs(righ - lef) <= l)) return 1;
else return 0;
}
else{
upp -= l;
righ -= l;
work(righ,upp,l,t);
if(check(l,t - 1)){
delett(righ,upp,l,t);
return 1;
}
delett(righ,upp,l,t);
work(lef,upp,l,t);
if(check(l,t - 1)){
delett(lef,upp,l,t);
return 1;
}
delett(lef,upp,l,t);
work(righ,downn,l,t);
if(check(l,t - 1)){
delett(righ,downn,l,t);
return 1;
}
delett(righ,downn,l,t);
work(lef,downn,l,t);
if(check(l,t - 1)){
delett(righ,downn,l,t);
return 1;
}
delett(righ,downn,l,t);
}
return 0;
}
int main(){
ll i,j,k;
cin>>n;
for(i = 1;i <= n;i++) cin>>A[i].x>>A[i].y;
ll l = 1,r = 1e9 + 1,mid;
if(n == 0){
cout<<0;
return 0;
}
if(n == 1){
cout<<1;
return 0;
}
while(l < r){
mid = (l + r) / 2;
if(check(mid,3)) r = mid;
else l = mid + 1;
}
cout<<l;
return 0;
}
蒟蒻实在不行了qwq一直WA