Submission #92151

#TimeUsernameProblemLanguageResultExecution timeMemory
92151KastandaKocka (COCI18_kocka)C++11
70 / 70
62 ms5916 KiB
#include<bits/stdc++.h> using namespace std; const int N = 100005; int n, L[N], R[N], U[N], D[N]; int l[N], r[N], u[N], d[N]; inline void Upd(int x, int y) { if (y >= 1) L[x] = min(L[x], y); if (y <= n) R[x] = max(R[x], y); if (x >= 1) U[y] = min(U[y], x); if (x <= n) D[y] = max(D[y], x); } int main() { scanf("%d", &n); memset(L, 63, sizeof(L)); memset(R, -1, sizeof(R)); memset(U, 63, sizeof(U)); memset(D, -1, sizeof(D)); for (int i = 1; i <= n; i++) { scanf("%d", &l[i]); if (l[i] != -1) l[i] ++; else l[i] = n + 1; Upd(i, l[i]); } for (int i = 1; i <= n; i++) { scanf("%d", &r[i]); if (r[i] != -1) r[i] = n - r[i]; else r[i] = 0; Upd(i, r[i]); } for (int i = 1; i <= n; i++) { scanf("%d", &u[i]); if (u[i] != -1) u[i] ++; else u[i] = n + 1; Upd(u[i], i); } for (int i = 1; i <= n; i++) { scanf("%d", &d[i]); if (d[i] != -1) d[i] = n - d[i]; else d[i] = 0; Upd(d[i], i); } bool Fail = 0; for (int i = 1; i <= n; i++) { if (l[i] != L[i]) Fail = 1; if (r[i] != R[i]) Fail = 1; if (u[i] != U[i]) Fail = 1; if (d[i] != D[i]) Fail = 1; } puts(Fail ? "NE" : "DA"); return (0); }

Compilation message (stderr)

kocka.cpp: In function 'int main()':
kocka.cpp:15:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
kocka.cpp:22:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &l[i]);
         ~~~~~^~~~~~~~~~~~~
kocka.cpp:29:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &r[i]);
         ~~~~~^~~~~~~~~~~~~
kocka.cpp:36:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &u[i]);
         ~~~~~^~~~~~~~~~~~~
kocka.cpp:43:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &d[i]);
         ~~~~~^~~~~~~~~~~~~
#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...