#include using namespace std; #define For(i, a, n) for(int i =a;i pii; template void dbg(Args&&... args){ ((cerr< pair operator+(const pair&a, const pair& b){ return {a.first +b.first, a.second + b.second}; } template pair operator-(const pair&a, const pair& b){ return {a.first -b.first, a.second - b.second}; } template ostream& operator<< (ostream& os, const pair& a){ return os<<"("< basic_ostream& operator<<(basic_ostream& os, const C&c){ for(auto it=begin(c); it!=end(c);++it){ os<<(it==begin(c)?"":" ")<<*it; } return os; } vector> points; bool comparehor(ll one, ll other){ pii a = points[one]; pii b = points[other]; if(a.first < b.first){ return true; } if(a.first > b.first){ return false; } return a.second < b.second; } bool comparever(ll one, ll other){ pii a = points[one]; pii b = points[other]; if(a.second < b.second){ return true; } if(a.second > b.second){ return false; } return a.first > b.first; } void solve(){ ll n; cin >> n; vector used(n); vector horsort(n); vector versort(n); For(i,0,n){ ll x,y; cin >> x >> y; pair point(x,y); points.push_back(point); used[i] = false; horsort[i] = i; versort[i] = i; } sort(horsort.begin(),horsort.end(),comparehor); sort(versort.begin(),versort.end(),comparever); ll hs = 0; ll vs = 0; ll he = n-1; ll ve = n-1; For(i,0,n/4-1){ used[horsort[hs]] = true; used[versort[vs]] = true; used[horsort[he]] = true; used[versort[ve]] = true; while(used[horsort[hs]]){ hs++; } while(used[versort[vs]]){ vs++; } while(used[horsort[he]]){ he--; } while(used[versort[ve]]){ ve--; } } pii wid = points[horsort[hs]] - points[versort[vs]]; pii hei = points[horsort[hs]] - points[versort[ve]]; ll square = (wid.first*wid.first + wid.second*wid.second)*(hei.first*hei.first + hei.second*hei.second); cout << (ll)sqrt(square) << "\n"; } main(){ cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); int t=1;//cin>>t; while(t--){ solve(); } }