QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#236405 | #7730. Convex Checker | fstqwq | WA | 21ms | 5228kb | C++14 | 1.3kb | 2023-11-03 22:17:17 | 2023-11-03 22:17:17 |
Judging History
你现在查看的是最新测评结果
- [2024-07-04 19:27:17]
- hack成功,自动添加数据
- (/hack/727)
- [2024-07-04 19:17:30]
- hack成功,自动添加数据
- (/hack/726)
- [2023-12-08 14:40:48]
- hack成功,自动添加数据
- (//qoj.ac/hack/493)
- [2023-11-07 10:32:52]
- hack成功,自动添加数据
- (//qoj.ac/hack/426)
- [2023-11-07 10:28:41]
- hack成功,自动添加数据
- (//qoj.ac/hack/425)
- [2023-11-03 22:17:17]
- 提交
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef double LD;
typedef pair <int, int> pii;
const LD PI = acos(-1.0);
#define cp const point &
struct point {
LL x, y;
point () {}
point (LL xx, LL yy) { x = xx, y = yy; }
point operator + (cp a) const { return {x + a.x, y + a.y}; }
point operator - (cp a) const { return {x - a.x, y - a.y}; }
bool operator < (cp a) const {
return make_pair(x, y) < make_pair(a.x, a.y);
}
};
LL det (point a, point b) {
return a.x * b.y - b.x * a.y;
}
void work () {
int n;
cin >> n;
vector <point> a;
for (int i = 0; i < n; i++) {
int x, y;
cin >> x >> y;
a.push_back({x, y});
}
if (det(a[1] - a[0], a[2] - a[0]) < 0) reverse(a.begin(), a.end());
bool flag = true;
double ans = 0;
for (int i = 0; i < n; i++) {
auto u = a[(i + 2) % n] - a[(i + 1) % n];
auto v = a[i] - a[(i + 1) % n];
auto uu = atan2(u.y, u.x);
auto vv = atan2(v.y, v.x);
auto d = vv - uu;
if (d < 0) d += 2 * PI;
if (isnan(d) || abs(d) <= 1e-12 || abs(PI - d) <= 1e-12) flag = false;
ans += d;
}
puts (flag && abs(ans - (n - 2) * PI) < 0.1 ? "Yes" : "No");
}
int main() {
ios::sync_with_stdio(false); cin.tie(0);
int T = 1;
for (int ca = 1; ca <= T; ca ++)
work();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 4108kb
input:
3 0 0 1 0 0 1
output:
Yes
result:
ok answer is YES
Test #2:
score: 0
Accepted
time: 0ms
memory: 3924kb
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: 3892kb
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: 3616kb
input:
3 0 0 0 0 0 0
output:
No
result:
ok answer is NO
Test #5:
score: 0
Accepted
time: 0ms
memory: 4108kb
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: 3776kb
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: 4164kb
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: 21ms
memory: 5100kb
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: 0
Accepted
time: 17ms
memory: 5152kb
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:
Yes
result:
ok answer is YES
Test #11:
score: 0
Accepted
time: 17ms
memory: 5220kb
input:
128369 146452483 526399214 146453715 526394712 146454820 526390674 146456370 526385008 146457099 526382343 146457964 526379180 146458751 526376302 146460091 526371401 146460722 526369093 146461114 526367659 146462323 526363236 146463053 526360565 146464791 526354204 146465863 526350280 146467488 526...
output:
Yes
result:
ok answer is YES
Test #12:
score: 0
Accepted
time: 21ms
memory: 5192kb
input:
128629 -49533670 490353833 -49532992 490346840 -49532611 490342912 -49531898 490335566 -49531313 490329543 -49531185 490328226 -49530713 490323370 -49530074 490316799 -49529672 490312668 -49528947 490305222 -49528647 490302143 -49528203 490297587 -49527568 490291076 -49527548 490290871 -49527039 490...
output:
Yes
result:
ok answer is YES
Test #13:
score: 0
Accepted
time: 21ms
memory: 5208kb
input:
128259 75790065 403382855 75793744 403383837 75801054 403385789 75805360 403386939 75810275 403388252 75813681 403389162 75820264 403390921 75830809 403393740 75832118 403394090 75837226 403395456 75840000 403396198 75844837 403397492 75849584 403398762 75852835 403399632 75860658 403401726 75865562...
output:
Yes
result:
ok answer is YES
Test #14:
score: -100
Wrong Answer
time: 21ms
memory: 5228kb
input:
128166 46176199 599926866 46170746 599926657 46165737 599926465 46159641 599926231 46152002 599925937 46147638 599925769 46143595 599925613 46138544 599925418 46131124 599925131 46125834 599924926 46120627 599924724 46118799 599924653 46115505 599924525 46110055 599924313 46109413 599924288 46107744...
output:
Yes
result:
wrong answer expected NO, found YES