QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#469756 | #7730. Convex Checker | Purslane# | WA | 0ms | 3656kb | C++14 | 900b | 2024-07-09 23:22:55 | 2024-07-09 23:22:56 |
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) {
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