Submission #477017

#TimeUsernameProblemLanguageResultExecution timeMemory
477017rainboyKocka (COCI18_kocka)C11
70 / 70
63 ms5348 KiB
#include <stdio.h> #include <string.h> #define N 100000 int main() { static int ll[N], rr[N], uu[N], dd[N], ii1[N], ii2[N], jj1[N], jj2[N]; int n, i, j; scanf("%d", &n); for (i = 0; i < n; i++) scanf("%d", &ll[i]); for (i = 0; i < n; i++) scanf("%d", &rr[i]); for (j = 0; j < n; j++) scanf("%d", &uu[j]); for (j = 0; j < n; j++) scanf("%d", &dd[j]); for (i = 0; i < n; i++) { if ((ll[i] == -1) != (rr[i] == -1) || ll[i] + rr[i] >= n) { printf("NE\n"); return 0; } if (ll[i] == -1) ll[i] = rr[i] = n; rr[i] = n - 1 - rr[i]; } for (i = 0; i < n; i++) { if ((uu[i] == -1) != (dd[i] == -1) || uu[i] + dd[i] >= n) { printf("NE\n"); return 0; } if (uu[i] == -1) uu[i] = dd[i] = n; dd[i] = n - 1 - dd[i]; } for (j = 0; j < n; j++) ii1[j] = n, ii2[j] = -1; for (i = 0; i < n; i++) { if ((j = ll[i]) != n) { if (ii1[j] == -1) ii1[j] = i; ii2[j] = i; } if ((j = rr[i]) != -1) { if (ii1[j] == -1) ii1[j] = i; ii2[j] = i; } } for (j = 0; j < n; j++) if (ii1[j] < uu[j] || ii2[j] > dd[j]) { printf("NE\n"); return 0; } for (i = 0; i < n; i++) jj1[i] = n, jj2[i] = -1; for (j = 0; j < n; j++) { if ((i = uu[j]) != n) { if (jj1[i] == -1) jj1[i] = j; jj2[i] = j; } if ((i = dd[j]) != -1) { if (jj1[i] == -1) jj1[i] = j; jj2[i] = j; } } for (i = 0; i < n; i++) if (jj1[i] < ll[i] || jj2[i] > rr[i]) { printf("NE\n"); return 0; } printf("DA\n"); return 0; }

Compilation message (stderr)

kocka.c: In function 'main':
kocka.c:10:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
kocka.c:12:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |   scanf("%d", &ll[i]);
      |   ^~~~~~~~~~~~~~~~~~~
kocka.c:14:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |   scanf("%d", &rr[i]);
      |   ^~~~~~~~~~~~~~~~~~~
kocka.c:16:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |   scanf("%d", &uu[j]);
      |   ^~~~~~~~~~~~~~~~~~~
kocka.c:18:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |   scanf("%d", &dd[j]);
      |   ^~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...