# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
92151 | 2019-01-01T17:44:06 Z | Kastanda | Kocka (COCI18_kocka) | C++11 | 62 ms | 5916 KB |
#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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 1912 KB | Output is correct |
2 | Correct | 3 ms | 2040 KB | Output is correct |
3 | Correct | 3 ms | 1956 KB | Output is correct |
4 | Correct | 3 ms | 1912 KB | Output is correct |
5 | Correct | 13 ms | 1912 KB | Output is correct |
6 | Correct | 3 ms | 1912 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 1912 KB | Output is correct |
2 | Correct | 3 ms | 1912 KB | Output is correct |
3 | Correct | 3 ms | 1912 KB | Output is correct |
4 | Correct | 3 ms | 1912 KB | Output is correct |
5 | Correct | 3 ms | 1916 KB | Output is correct |
6 | Correct | 3 ms | 1912 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 52 ms | 5368 KB | Output is correct |
2 | Correct | 61 ms | 5788 KB | Output is correct |
3 | Correct | 56 ms | 5784 KB | Output is correct |
4 | Correct | 34 ms | 4600 KB | Output is correct |
5 | Correct | 57 ms | 5792 KB | Output is correct |
6 | Correct | 56 ms | 5752 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 54 ms | 5496 KB | Output is correct |
2 | Correct | 35 ms | 4600 KB | Output is correct |
3 | Correct | 62 ms | 5916 KB | Output is correct |
4 | Correct | 42 ms | 4856 KB | Output is correct |
5 | Correct | 60 ms | 5796 KB | Output is correct |
6 | Correct | 54 ms | 5468 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 52 ms | 5320 KB | Output is correct |
2 | Correct | 34 ms | 4600 KB | Output is correct |
3 | Correct | 56 ms | 5752 KB | Output is correct |
4 | Correct | 56 ms | 5752 KB | Output is correct |
5 | Correct | 58 ms | 5752 KB | Output is correct |
6 | Correct | 34 ms | 4680 KB | Output is correct |