Submission #485862

#TimeUsernameProblemLanguageResultExecution timeMemory
485862rainboySIR (COI15_sir)C11
12 / 100
16 ms332 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...