传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=2338
n^2枚举对角线
记录长度和中点
矩阵的对角线长度相等,中点相同
暴力就好了
似乎有数据可以卡?
Code:
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn=1501;
struct point{
LL x,y;
point(LL _x=0,LL _y=0):x(_x),y(_y){}
bool operator<(point oth)const{return x<oth.x||(x==oth.x&&y<oth.y);}
bool operator==(point oth)const{return x==oth.x&&y==oth.y;};
point operator+(point oth)const{return point(x+oth.x,y+oth.y);}
point operator-(point oth)const{return point(x-oth.x,y-oth.y);}
LL operator*(point oth)const{return x*oth.y-y*oth.x;}
}a[maxn];
LL sqr(LL x){return x*x;}
struct Line{
LL len;
int i,j;
point md;
bool operator==(Line oth)const{return len==oth.len&&md==oth.md;}
bool operator<(Line oth)const{if(len==oth.len)return md<oth.md;return len<oth.len;}
}L[maxn*maxn>>1];
int n,m;
LL LLabs(LL x){return x<0?-x:x;}
int main(){
scanf("%d",&n);
for(int i=1;i<=n;i++)scanf("%lld%lld",&a[i].x,&a[i].y);
for(int i=1;i<=n;i++){
for(int j=i+1;j<=n;j++){
m++;
L[m].i=i;L[m].j=j;
L[m].len=sqr(a[i].x-a[j].x)+sqr(a[i].y-a[j].y);
L[m].md=a[i]+a[j];
}
}sort(L+1,L+1+m);
LL ans=0;
for(int i=1;i<=m;i++)
for(int j=i-1;j&&L[i]==L[j];j--)
ans=max(ans,LLabs((a[L[i].i]-a[L[j].i])*(a[L[i].i]-a[L[j].j])));
cout<<ans<<endl;
return 0;
}