https://codeforces.com/problemset/problem/1299/B
這道水題想了一年。。。。
其實看樣例都能猜出來,讓(0,0)在凸包的邊界上移動,最後得到的圖形要與原圖形相似,就是每條邊的長度比例不能邊,而且不能多出新的邊,也不能與原邊不平行。
可以想到,讓(0,0)在一條邊a上移動時,那麼距離這條邊最遠的點就會移動成新的圖形的一條邊,如果最遠的點是一個點而不是一條邊上的點,那麼那個地方就多出了一條邊,肯定不相似的,所以最遠的必須是一條平行邊上的點。
設最遠爲b,然後可以想到對應的邊長度是La+Lb,而反過來再b上移動時,對應邊也是La+Lb,因爲邊的比例要相同,所以La=Lb
#include<bits/stdc++.h>
using namespace std;
const int maxl=3e5+10;
int n,m,ans;
struct point
{
int x,y;
point(int a=0,int b=0)
{
x=a;y=b;
}
point operator - (const point &b)const
{
return point(x-b.x,y-b.y);
}
}a[maxl];
inline long long det(point a,point b)
{
return 1ll*a.x*b.y-1ll*a.y*b.x;
}
inline void prework()
{
scanf("%d",&n);
for(int i=1;i<=n;i++)
scanf("%d%d",&a[i].x,&a[i].y);
a[n+1]=a[1];
}
inline void mainwork()
{
if(n&1)
return;
ans=1;int l; point x,y;
for(int i=1;i<=n/2;i++)
{
l=n/2+i;
x=a[i+1]-a[i];
y=a[l+1]-a[l];
if((x.x!=y.x && x.x!=-y.x) || (x.y!=y.y && x.y!=-y.y))
{
ans=0;
return;
}
}
}
inline void print()
{
if(ans)
puts("YES");
else
puts("NO");
}
int main()
{
int t=1;
//scanf("%d",&t);
for(int i=1;i<=t;i++)
{
prework();
mainwork();
print();
}
return 0;
}