旋转卡壳板子(平面最近点对)。随便乱做就能过了。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#include<bits/stdc++.h>
using namespace std;
const double eps=1e-8,PI=acos(-1.0);
struct point{
double x,y;
point(double u=0.0,double v=0.0):x{u},y{v}{}
point operator+(point r){return point(x+r.x,y+r.y);}
point operator-(point r){return point(x-r.x,y-r.y);}
double operator^(const point &b)const{return x*b.y-y*b.x;}
double operator*(const point &b)const{return x*b.x+y*b.y;}
point operator/(double a){return point(x/a,y/a);}
point &operator=(point r){x=r.x,y=r.y;return *this;}
double norm()const{return x*x+y*y;}
double abs(){return (norm());}
bool operator<(const point &r)const{
return x!=r.x?x<r.x:y<r.y;
}
bool operator==(const point &r)const{
return fabs(x-r.x)<eps&&fabs(y-r.y)<eps;
}
void trans(double b){double tx=x,ty=y;x=tx*cos(b)-ty*sin(b);y=tx*sin(b)+ty*cos(b);}
}a[1000010],b[1000010];
inline bool check(point a,point b,point c){return((c^a)>=0&&(b^c)>=0&&((a-b)^(c-b))>=0);}
inline bool cmp1(const point &a,const point &b){return a.x!=b.x?a.x<b.x:a.y<b.y;}
inline bool cmp2(const point &a,const point &b){return (a^b)==0?(a*a)<(b*b):(a^b)>0;}
int n,m;
void polarsort(){
sort(a+1,a+n+1,cmp1);
for(register int i=2;i<=n;++i)a[i]=a[i]-a[1];
a[1].x=a[1].y=0;sort(a+1,a+n+1,cmp2);
}
void hull(){
polarsort();
b[1]=a[1];b[2]=a[2];b[3]=a[3];m=3;
for(register int i=4;i<=n;++i) {
while(check(a[i],b[m-1],b[m])&&m>2)--m;
b[++m]=a[i];
}
}
double ans=0;
bool cmp(point a,point b){
return a.x*a.x+a.y*a.y<b.x*b.x+b.y*b.y;
}
inline double disx(int x,int y){
return (b[x].x-b[y].x)*(b[x].x-b[y].x);
}
inline double disy(int x,int y){
return (b[x].y-b[y].y)*(b[x].y-b[y].y);
}
inline double dis2x(int x,int y){
return (a[x].x-a[y].x)*(a[x].x-a[y].x);
}
inline double dis2y(int x,int y){
return (a[x].y-a[y].y)*(a[x].y-a[y].y);
}
inline double dis2(int x,int y){
return dis2x(x,y)+dis2y(x,y);
}
inline double dis(int x,int y){
return disx(x,y)+disy(x,y);
}
const long long K1=1e8,K2=1e18;
inline bool dl1(const point &a,const point &b){
return a.x<b.x;
}
inline bool dl2(const point &a,const point &b){
return a.y<b.y;
}
int main(){
scanf("%d",&n);
for(register int i=1;i<=n;++i)scanf("%lf%lf",&a[i].x,&a[i].y);
hull();
sort(b+1,b+m+1,cmp);
int x=1,y=1;
int z[9];
long long sz[9]={0,K1,K1,-K1,-K1,K1,-K1,K2,-K2};
for(register int i=1;i<=m;++i)
if(sz[1]>b[i].x)sz[1]=b[i].x,z[1]=i;
for(register int i=1;i<=m;++i)
if(sz[2]>b[i].y)sz[2]=b[i].y,z[2]=i;
for(register int i=1;i<=m;++i)
if(sz[3]<b[i].x)sz[3]=b[i].x,z[3]=i;
for(register int i=1;i<=m;++i)
if(sz[4]<b[i].y)sz[4]=b[i].y,z[4]=i;
for(register int i=1;i<=m;++i)
if(sz[5]>b[i].x+b[i].y)sz[5]=b[i].x+b[i].y,z[5]=i;
for(register int i=1;i<=m;++i)
if(sz[6]<b[i].x+b[i].y)sz[6]=b[i].x+b[i].y,z[6]=i;
for(register int i=1;i<=m;++i)
if(sz[7]>(long long)1ll*b[i].x*b[i].y)sz[7]=(long long)1ll*b[i].x*b[i].y,z[7]=i;
for(register int i=1;i<=m;++i)
if(sz[8]<(long long)1ll*b[i].x*b[i].y)sz[8]=(long long)1ll*b[i].x*b[i].y,z[8]=i;
for(register int i=1;i<n;++i)
for(register int j=i+1;j<=i+70&&j<=n;++j){
double t=sqrt(dis(i,j));
if(ans<t)x=i,y=j,ans=t;
}
for(register int i=1;i<=n;++i)ans=max(ans,sqrt(dis(i,x)));
for(register int i=1;i<=n;++i)ans=max(ans,sqrt(dis(i,y)));
for(register int i=1;i<n;++i)
for(register int j=n;j>=n-70&&j>=1;--j){
double t=sqrt(dis(i,j));
if(ans<t)x=i,y=j,ans=t;
}
for(register int i=1;i<=n;++i)ans=max(ans,sqrt(dis(i,x)));
for(register int i=1;i<=n;++i)ans=max(ans,sqrt(dis(i,y)));
for(register int i=1;i<n;++i)
for(register int j=1;j<=70&&j<=n;++j){
double t=sqrt(dis(i,j));
if(ans<t)x=i,y=j,ans=t;
}
for(register int i=1;i<=n;++i)ans=max(ans,sqrt(dis(i,x)));
for(register int i=1;i<=n;++i)ans=max(ans,sqrt(dis(i,y)));
for(register int i=1;i<=n;++i)
for(register int j=1;j<=4;++j)ans=max(ans,sqrt(dis(i,z[j])));
for(register int i=1;i<=m;++i)
for(register int j=i+1;j<=i+160&&j<=m;++j){
double t=(dis(i,j));
if(ans<t)x=i,y=j,ans=t;
}
for(register int i=1;i<=m;++i)ans=max(ans,(dis(i,x)));
for(register int i=1;i<=m;++i)ans=max(ans,(dis(i,y)));
for(register int i=1;i<=m;++i)
for(register int j=m;j>=m-160&&j>=1;--j){
double t=(dis(i,j));
if(ans<t)x=i,y=j,ans=t;
}
for(register int i=1;i<=m;++i)ans=max(ans,(dis(i,x)));
for(register int i=1;i<=m;++i)ans=max(ans,(dis(i,y)));
for(register int i=1;i<=m;++i)
for(register int j=1;j<=160&&j<=m;++j){
double t=(dis(i,j));
if(ans<t)x=i,y=j,ans=t;
}
for(register int i=1;i<=m;++i)ans=max(ans,(dis(i,x)));
for(register int i=1;i<=m;++i)ans=max(ans,(dis(i,y)));
for(register int i=1;i<=m;++i)
for(register int j=1;j<=8;++j)ans=max(ans,(dis(i,z[j])));
for(register int times=1;times<=72&&(1.0*clock()/CLOCKS_PER_SEC)<=0.985;++times){
double tmp=0;
for(register int i=1;i<=m&&(1.0*clock()/CLOCKS_PER_SEC)<=0.99;++i){
double t=(dis(i,x));
if(tmp<t)y=i,tmp=t;
}
x=y;ans=max(ans,tmp);
}
printf("%.0lf\n",ans);
return 0;
}