QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#313199#7730. Convex CheckerunclezhouWA 1ms4124kbC++141.1kb2024-01-24 16:33:422024-01-24 16:33:43

Judging History

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

  • [2024-07-04 19:27:17]
  • hack成功,自动添加数据
  • (/hack/727)
  • [2024-07-04 19:17:30]
  • hack成功,自动添加数据
  • (/hack/726)
  • [2024-01-24 16:33:43]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:4124kb
  • [2024-01-24 16:33:42]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
typedef double DB;
const int N=2e5+10;

int n;

struct point{
    DB x,y;
    point operator + (const point &a) const{
        return {x+a.x,y+a.y};
    }
    point operator - (const point &a) const{
        return {x-a.x,y-a.y};
    }
    point operator * (DB a) const{
        return {x*a,y*a};
    }
};

struct line{
    point s,t;
};

DB dot (const point &a,const point &b){
    return a.x*b.x+a.y*b.y;
}

DB det (const point &a,const point &b){
    return a.x*b.y-a.y*b.x;
}

DB sqr(DB a){
    return a*a;
}

DB dis (const point &a){
    return (sqrt(sqr(a.x)+sqr(a.y)));
}

point a[N];

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i].x>>a[i].y;
    }
    DB t=0;
    a[1+n]=a[1];
    a[2+n]=a[2];
    for(int i=1;i<=n;i++){
        //line u,v;
        point u=a[i+1]-a[i];
        point v=a[i+2]-a[i+1];
        if(det(u,v)==0){
            cout<<"No\n";
            return 0;
        }
        t+=(acos(dot(u,v)/dis(u)/dis(v)));
    }
    if(t==2*acos(-1)){
        cout<<"Yes\n";
    }
    else cout<<"No\n";
    //cout<<t<<'\n';
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 4060kb

input:

3
0 0
1 0
0 1

output:

Yes

result:

ok answer is YES

Test #2:

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

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: 4124kb

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: 3736kb

input:

3
0 0
0 0
0 0

output:

No

result:

ok answer is NO

Test #5:

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

input:

5
1 0
4 1
0 1
2 0
3 2

output:

No

result:

ok answer is NO

Test #6:

score: 0
Accepted
time: 1ms
memory: 4060kb

input:

5
0 0
1000000000 0
1000000000 500000000
1000000000 1000000000
0 1000000000

output:

No

result:

ok answer is NO

Test #7:

score: 0
Accepted
time: 1ms
memory: 4032kb

input:

5
0 0
1000000000 0
1000000000 499999999
1000000000 1000000000
0 1000000000

output:

No

result:

ok answer is NO

Test #8:

score: -100
Wrong Answer
time: 0ms
memory: 4000kb

input:

5
0 0
999999999 0
1000000000 50000000
999999999 1000000000
0 1000000000

output:

No

result:

wrong answer expected YES, found NO