QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#469755 | #7730. Convex Checker | Purslane# | WA | 1ms | 5756kb | C++14 | 739b | 2024-07-09 23:20:13 | 2024-07-09 23:20:14 |
Judging History
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) {
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;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3712kb
input:
3 0 0 1 0 0 1
output:
Yes
result:
ok answer is YES
Test #2:
score: 0
Accepted
time: 1ms
memory: 5756kb
input:
4 0 0 0 1 1 1 1 0
output:
Yes
result:
ok answer is YES
Test #3:
score: 0
Accepted
time: 1ms
memory: 5680kb
input:
4 0 0 0 3 1 2 1 1
output:
Yes
result:
ok answer is YES
Test #4:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
3 0 0 0 0 0 0
output:
No
result:
ok answer is NO
Test #5:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
5 1 0 4 1 0 1 2 0 3 2
output:
No
result:
ok answer is NO
Test #6:
score: -100
Wrong Answer
time: 0ms
memory: 3576kb
input:
5 0 0 1000000000 0 1000000000 500000000 1000000000 1000000000 0 1000000000
output:
Yes
result:
wrong answer expected NO, found YES