Submission #537116

#TimeUsernameProblemLanguageResultExecution timeMemory
537116rainboy별자리 2 (JOI14_constellation2)C11
55 / 100
9070 ms340 KiB
#include <stdio.h> #include <string.h> #define N 3000 int xx[N], yy[N], cc[N]; long long cross(int i, int j, int k) { return (long long) (xx[j] - xx[i]) * (yy[k] - yy[i]) - (long long) (xx[k] - xx[i]) * (yy[j] - yy[i]); } int main() { static int kk[3], ll[3]; int n, i, j, k; long long ans; scanf("%d", &n); for (i = 0; i < n; i++) scanf("%d%d%d", &xx[i], &yy[i], &cc[i]); ans = 0; for (i = 0; i < n; i++) for (j = i + 1; j < n; j++) { memset(kk, 0, sizeof kk); memset(ll, 0, sizeof ll); for (k = 0; k < n; k++) if (k != i && k != j) { if (cross(i, j, k) < 0) kk[cc[k]]++; else ll[cc[k]]++; } ans += (long long) kk[(cc[i] + 1) % 3] * kk[(cc[i] + 2) % 3] * ll[(cc[j] + 1) % 3] * ll[(cc[j] + 2) % 3]; } printf("%lld\n", ans); return 0; }

Compilation message (stderr)

constellation2.c: In function 'main':
constellation2.c:17:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
constellation2.c:19:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |   scanf("%d%d%d", &xx[i], &yy[i], &cc[i]);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...