QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#673721#7730. Convex CheckerYansuan_HClWA 0ms3608kbC++201.5kb2024-10-25 09:22:492024-10-25 09:22:49

Judging History

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

  • [2024-10-25 09:22:49]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3608kb
  • [2024-10-25 09:22:49]
  • 提交

answer

#include <bits/stdc++.h>
#define ms(x, v) memset(x, v, sizeof(x))
#define il __attribute__((always_inline)) static
#define U(i,l,r) for(int i(l),END##i(r);i<=END##i;++i)
#define D(i,r,l) for(int i(r),END##i(l);i>=END##i;--i)
using namespace std;
using ll = long long;

#define IC isdigit(c)
#define GC c=getchar()
void rd(auto &x) { x = 0; char GC; bool f = 0;
	for (; !IC; GC) f |= c == '-';
	for (; IC; GC) x = x * 10 + c - 48;
	if (f) x = -x;
}
void rd(auto &x, auto &...y) { rd(x); rd(y...); }
#define meow(...) fprintf(stderr, __VA_ARGS__)
#define Assert(e, v) if (!(e)) { meow("AF@%d\n", __LINE__ ); exit(v); }

#define vc vector
#define eb emplace_back
#define pb push_back

void no() { puts("No"); exit(0); }

const int N = 200005;
int n;
using pt = complex<ll>;
#define X real()
#define Y imag()
ll cross(pt l, pt r) { return l.X * r.Y - l.Y * r.X; }

pt a[N];

int main() {
//	freopen("ava.in", "r", stdin);
	
	rd(n);
	U (i, 1, n) {
		ll x, y; rd(x, y);
		a[i] = {x, y};
	}
//	sort(a + 1, a + n + 1, [&](pt u, pt v) {
//		return u.X == v.X ? u.Y < v.Y : u.X < v.X; });
//	U (i, 2, n)
//		if (a[i] == a[i - 1]) 
//			no();
//	D (i, n, 1) a[i] -= a[1];
//	sort(a + 2, a + n + 1, [&](pt u, pt v) {
//		ll x = cross(u, v);
//		return x == 0 ? u.X < v.X : (x < 0);
//	});
//	U (i, 1, n) {
//		clog << a[i].X << ' ' << a[i].Y << endl;
//	}
	U (i, 1, n) {
		int j = i % n + 1, k = (i + 1) % n + 1;
		if (cross(a[j] - a[i], a[k] - a[j]) >= 0)
			no();
	}
	puts("Yes");
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3608kb

input:

3
0 0
1 0
0 1

output:

No

result:

wrong answer expected YES, found NO