QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#469754#7730. Convex CheckerPurslane#WA 1ms5752kbC++14546b2024-07-09 23:17:362024-07-09 23:17:36

Judging History

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

  • [2024-07-09 23:17:36]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5752kb
  • [2024-07-09 23:17:36]
  • 提交

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],sum1,sum2;
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,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: 100
Accepted
time: 1ms
memory: 5752kb

input:

3
0 0
1 0
0 1

output:

Yes

result:

ok answer is YES

Test #2:

score: 0
Accepted
time: 0ms
memory: 3548kb

input:

4
0 0
0 1
1 1
1 0

output:

Yes

result:

ok answer is YES

Test #3:

score: 0
Accepted
time: 0ms
memory: 3556kb

input:

4
0 0
0 3
1 2
1 1

output:

Yes

result:

ok answer is YES

Test #4:

score: -100
Wrong Answer
time: 1ms
memory: 5608kb

input:

3
0 0
0 0
0 0

output:

Yes

result:

wrong answer expected NO, found YES