QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#312687#7730. Convex CheckerhazeWA 12ms5228kbC++232.0kb2024-01-24 10:44:102024-07-04 19:17:37

Judging History

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

  • [2024-07-04 19:27:17]
  • hack成功,自动添加数据
  • (/hack/727)
  • [2024-07-04 19:17:37]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:WA
  • 用时:12ms
  • 内存:5228kb
  • [2024-07-04 19:17:30]
  • hack成功,自动添加数据
  • (/hack/726)
  • [2024-01-24 10:44:10]
  • 评测
  • 测评结果:100
  • 用时:14ms
  • 内存:5208kb
  • [2024-01-24 10:44:10]
  • 提交

answer

/*
Author: haze
2023/11/13
16:27
*/

#include <bits/stdc++.h>

#define irep(i, l, r) for(int (i) = (l); (i) <= (r); ++(i))
#define drep(i, r, l) for(int (i) = (r); (i) >= (l); --(i))
#define ll long long
#define LL __int128
using namespace std;

inline ll read() {
    char ch = getchar();
    ll s = 0;
    bool w = 0;
    while (!isdigit(ch)) {
        if (ch == '-')w = 1;
        ch = getchar();
    }
    while (isdigit(ch))s = (s << 3) + (s << 1) + (ch ^ 48), ch = getchar();
    return w ? -s : s;
}

inline char rc() {
    char ch = getchar();
    while (1) {
        if (ch >= '!' && ch <= '~')return ch;
        ch = getchar();
    }
}

template<class T1, class T2>
T1 min(T1 AA, T2 BB) { return AA > BB ? BB : AA; }

template<class T1, class T2>
T1 max(T1 AA, T2 BB) { return AA < BB ? BB : AA; }

const int itinf = 1e9;
const ll llinf = 4e18;
const int mod = 1000000007;
const int N = 500009;

struct point{
    ll x, y;
    point(){}
    point(ll _x, ll _y){
        x = _x, y = _y;
    }
    point operator -(const point & A){
        return point(x - A.x, y - A.y);
    }
    point operator + (const point &A){
        return point(x + A.x, y + A.y);
    }
    ll operator ^(const point& A){
        return x * A.y - y * A.x;
    }
    ll operator *(const point& A){
        return x * A.x + y * A.y;
    }
};
double theta(point A, point B){
    return acos(1.00 * (A * B) / sqrt(A.x * A.x + A.y * A.y) / sqrt(B.x * B.x + B.y * B.y));
}
int sgn(ll x){
    return x == 0 ? 0 : x > 0 ? 1 : - 1;
}
int main() {
    int n = read();
    vector<point>a(n);
    double t = 0;
    irep(i, 0, n - 1){
        ll x = read(), y = read();
        a[i] = point(x, y);
    }
    irep(i, 0, n - 1){
        int i1 = i, i2 = (i + 1) % n, i3 = (i + 2) % n;
        if(((a[i2] - a[i1]) ^ (a[i3] - a[i2])) == 0){
            puts("No");
            return 0;
        }
        t += theta((a[i2] - a[i1]) , (a[i3] - a[i2]));
    }
    if(abs(t - 2 * acos(-1)) < 1e-8)puts("Yes");
    else puts("No");
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3708kb

input:

3
0 0
1 0
0 1

output:

Yes

result:

ok answer is YES

Test #2:

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

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

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

input:

3
0 0
0 0
0 0

output:

No

result:

ok answer is NO

Test #5:

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

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: 0ms
memory: 3808kb

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: 0ms
memory: 3952kb

input:

5
0 0
1000000000 0
1000000000 499999999
1000000000 1000000000
0 1000000000

output:

No

result:

ok answer is NO

Test #8:

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

input:

5
0 0
999999999 0
1000000000 50000000
999999999 1000000000
0 1000000000

output:

Yes

result:

ok answer is YES

Test #9:

score: 0
Accepted
time: 12ms
memory: 5200kb

input:

128312
5578014 410408218
5585076 410404717
5588011 410403262
5588473 410403033
5589740 410402405
5593295 410400643
5593751 410400417
5597248 410398684
5598935 410397848
5600618 410397014
5605185 410394751
5610514 410392111
5614281 410390245
5617263 410388768
5621142 410386847
5630840 410382045
56310...

output:

Yes

result:

ok answer is YES

Test #10:

score: -100
Wrong Answer
time: 12ms
memory: 5228kb

input:

128086
149550602 509469827
149551059 509465022
149551336 509462107
149551964 509455497
149552572 509449094
149553350 509440895
149553656 509437667
149554161 509432339
149554254 509431357
149554545 509428284
149555017 509423299
149555366 509419611
149555842 509414580
149556382 509408867
149556564 509...

output:

No

result:

wrong answer expected YES, found NO