QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#322742#7730. Convex CheckerieeWA 0ms3680kbC++17559b2024-02-07 16:33:252024-02-07 16:33:26

Judging History

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

  • [2024-07-04 19:27:17]
  • hack成功,自动添加数据
  • (/hack/727)
  • [2024-07-04 19:17:30]
  • hack成功,自动添加数据
  • (/hack/726)
  • [2024-02-07 16:33:26]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3680kb
  • [2024-02-07 16:33:25]
  • 提交

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;
}

Details

Tip: Click on the bar to expand more detailed information

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