几何+思维——cf1299b
结论:只要多边形的所有对边都是两两平行的,就一定能满足条件
#include<bits/stdc++.h> using namespace std; #define N 300006 #define ll long long ll n,x[N],y[N]; int main(){ cin>>n; for(int i=0;i<n;i++)cin>>x[i]>>y[i]; if(n%2){puts("nO");return 0;} for(int i=0;i<n/2;i++){ ll x1=x[i]-x[i+1],y1=y[i]-y[i+1]; ll x2=x[i+n/2]-x[(i+n/2+1)%n]; ll y2=y[i+n/2]-y[(i+n/2+1)%n]; if(x1!=-x2 || y1!=-y2){puts("nO");return 0;} } puts("YES"); }