#include <stdio.h>
#define N 2000
__int128 abs_(__int128 a) { return a > 0 ? a : -a; }
__int128 cross(long long x0, long long y0, long long x1, long long y1, long long x2, long long y2) {
return (__int128) (x1 - x0) * (y2 - y0) - (__int128) (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++) {
__int128 c = cross(x, y, xx[i], yy[i], xx[(i + 1) % n], yy[(i + 1) % n]);
if (c < 0)
cnt++;
else if (c == 0) {
cnt = 0;
break;
}
}
if (cnt < n / 2)
printf("DA\n"), k++;
else
printf("NE\n");
}
return 0;
}
Compilation message
popcount.c: In function 'main':
popcount.c:15:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
15 | scanf("%d%d", &online, &n);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
popcount.c:17:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
17 | scanf("%d%d", &xx[i], &yy[i]);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
popcount.c:18:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
18 | scanf("%d", &q);
| ^~~~~~~~~~~~~~~
popcount.c:24:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
24 | scanf("%lld%lld", &x, &y);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1073 ms |
32944 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1086 ms |
41396 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1090 ms |
42628 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1092 ms |
41060 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |