QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#322742 | #7730. Convex Checker | iee | WA | 0ms | 3680kb | C++17 | 559b | 2024-02-07 16:33:25 | 2024-02-07 16:33:26 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vec = complex<ll>;
ll C(vec p, vec q) {
return imag(conj(p) * q);
}
int main() {
cin.tie(0)->sync_with_stdio(0);
int n;
cin >> n;
vector<vec> a(n);
for (vec &v : a) {
ll x, y;
cin >> x >> y;
v = {x, y};
}
if (C(a[1] - a[0], a[2] - a[0]) < 0) reverse(a.begin(), a.end());
for (int i = 0; i < n; i++) {
if (C(a[(i + 1) % n] - a[i], a[(i + 2) % n] - a[i]) <= 0) {
cout << "No" << "\n";
return 0;
}
}
cout << "Yes" << "\n";
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3676kb
input:
3 0 0 1 0 0 1
output:
Yes
result:
ok answer is YES
Test #2:
score: 0
Accepted
time: 0ms
memory: 3576kb
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: 3680kb
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: 3628kb
input:
3 0 0 0 0 0 0
output:
No
result:
ok answer is NO
Test #5:
score: -100
Wrong Answer
time: 0ms
memory: 3572kb
input:
5 1 0 4 1 0 1 2 0 3 2
output:
Yes
result:
wrong answer expected NO, found YES