이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#define N 2000
#define eps 1e-6
long double abs_(long double a) { return a > 0 ? a : -a; }
long double cross(long long x0, long long y0, long long x1, long long y1, long long x2, long long y2) {
return (long double) (x1 - x0) * (y2 - y0) - (long double) (x2 - x0) * (y1 - y0);
}
int main() {
static int xx[N], yy[N];
int n, q, online, i, k;
scanf("%d%d", &online, &n);
for (i = 0; i < n; i++)
scanf("%d%d", &xx[i], &yy[i]);
scanf("%d", &q);
k = 0;
while (q--) {
long long x, y;
int cnt;
scanf("%lld%lld", &x, &y);
if (online)
x ^= (long long) k * k * k, y ^= (long long) k * k * k;
cnt = 0;
for (i = 0; i < n; i++) {
long double c = cross(x, y, xx[i], yy[i], xx[(i + 1) % n], yy[(i + 1) % n]);
if (c < 0)
cnt++;
else if (abs_(c) < eps) {
cnt = 0;
break;
}
}
if (cnt < n / 2)
printf("DA\n"), k++;
else
printf("NE\n");
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
zvijezda.c: In function 'main':
zvijezda.c:16:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
16 | scanf("%d%d", &online, &n);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
zvijezda.c:18:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
18 | scanf("%d%d", &xx[i], &yy[i]);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
zvijezda.c:19:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
19 | scanf("%d", &q);
| ^~~~~~~~~~~~~~~
zvijezda.c:25:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
25 | scanf("%lld%lld", &x, &y);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |