#include <stdio.h>
#define N 300
long long max(long long a, long long b) { return a > b ? a : b; }
long long cross2(int x1, int y1, int x2, int y2) {
return (long long) x1 * y2 - (long long) x2 * y1;
}
long long cross(int x0, int y0, int x1, int y1, int x2, int y2) {
return cross2(x1 - x0, y1 - y0, x2 - x0, y2 - y0);
}
int main() {
static int xx[N], yy[N];
int n, m, i, i1, i2, j;
long long ans;
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%d%d", &xx[i], &yy[i]);
scanf("%d", &m);
for (j = 0; j < m; j++)
scanf("%d%d", &xx[n + j], &yy[n + j]);
ans = 0;
for (i1 = 0; i1 < n; i1++)
for (i2 = 0; i2 < n; i2++)
if (i2 != i1 && i2 != (i1 + 1) % n) {
int good = 1;
for (j = 0; j < m; j++)
if (cross(xx[i1], yy[i1], xx[i2], yy[i2], xx[n + j], yy[n + j]) <= 0) {
good = 0;
break;
}
if (good) {
long long area = cross2(xx[i2], yy[i2], xx[i1], yy[i1]);
for (i = i1; i != i2; i = (i + 1) % n)
area += cross2(xx[i], yy[i], xx[(i + 1) % n], yy[(i + 1) % n]);
ans = max(ans, area);
}
}
printf("%lld\n", ans);
return 0;
}
Compilation message
sir.c: In function 'main':
sir.c:20:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
20 | scanf("%d", &n);
| ^~~~~~~~~~~~~~~
sir.c:22:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
22 | scanf("%d%d", &xx[i], &yy[i]);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sir.c:23:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
23 | scanf("%d", &m);
| ^~~~~~~~~~~~~~~
sir.c:25:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
25 | scanf("%d%d", &xx[n + j], &yy[n + j]);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
13 ms |
280 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
588 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |