# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
485862 |
2021-11-09T14:39:36 Z |
rainboy |
SIR (COI15_sir) |
C |
|
16 ms |
332 KB |
#include <stdio.h>
#define N 300
#define M 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 + M], yy[N + M];
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:21:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
21 | scanf("%d", &n);
| ^~~~~~~~~~~~~~~
sir.c:23:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
23 | scanf("%d%d", &xx[i], &yy[i]);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sir.c:24:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
24 | scanf("%d", &m);
| ^~~~~~~~~~~~~~~
sir.c:26:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
26 | scanf("%d%d", &xx[n + j], &yy[n + j]);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
16 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
332 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |