Submission
Status:
PPPPPPPPPP
Score: 100
User: hmmm
Problemset: กางเต็นท์
Language: cpp
Time: 0.166 second
Submitted On: 2025-04-10 13:30:54
#include<bits/stdc++.h>
using namespace std;
map<int,int> mp[4];
int main(){
ios::sync_with_stdio(0); cin.tie(0);
int n;
cin >> n;
for(int i=1;i<=n;i++){
int x,y;
cin >> x >> y;
mp[0][x-y]=max(mp[0][x-y],x);
if(mp[1].find(x-y)!=mp[1].end()){
mp[1][x-y]=min(mp[1][x-y],x);
}
else mp[1][x-y]=x;
mp[2][x+y]=max(mp[2][x+y],x);
if(mp[3].find(x+y)!=mp[3].end()){
mp[3][x+y]=min(mp[3][x+y],x);
}
else mp[3][x+y]=x;
}
int mx=0;
for(auto e:mp[0]){
int x=e.second;
mx=max(mx,x-mp[1][e.first]);
}
for(auto e:mp[2]){
int x=e.second;
mx=max(mx,x-mp[3][e.first]);
}
cout << mx;
}