QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#469756#7730. Convex CheckerPurslane#WA 0ms3656kbC++14900b2024-07-09 23:22:552024-07-09 23:22:56

Judging History

你现在查看的是最新测评结果

  • [2024-07-09 23:22:56]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3656kb
  • [2024-07-09 23:22:55]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define ffor(i,a,b) for(int i=(a);i<=(b);i++)
#define roff(i,a,b) for(int i=(a);i>=(b);i--)
using namespace std;
const int MAXN=2e5+10;
int n,x[MAXN],y[MAXN];
__int128 sum1,sum2;
__int128 abs(__int128 x) {
	return x>=0?x:-x;
}
set<pair<int,int>> st;
signed main() {
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>n;
	ffor(i,1,n) cin>>x[i]>>y[i];
	ffor(i,1,n) {
		int dx1=x[i%n+1]-x[i],dy1=x[i%n+1]-x[i];
		int dx2=x[(i+1)%n+1]-x[i],dy2=y[(i+1)%n+1]-y[i];
		if(dx1*dy2==dy1*dx2) return cout<<"No",0;
	}
	ffor(i,1,n) {
		if(st.find({x[i],y[i]})!=st.end()) return cout<<"No",0;
		st.insert({x[i],y[i]});	
	}
	ffor(i,2,n-1) {
		int dx1=x[i]-x[1],dy1=y[i]-y[1],dx2=x[i+1]-x[1],dy2=y[i+1]-y[1];
		sum1+=dx1*dy2-dx2*dy1,sum2+=abs(dx1*dy2-dx2*dy1);
	}
	if(abs(sum1)==sum2) cout<<"Yes";
	else cout<<"No";
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3656kb

input:

3
0 0
1 0
0 1

output:

No

result:

wrong answer expected YES, found NO