# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
92449 | 2019-01-02T22:55:30 Z | ltomic | Kocka (COCI18_kocka) | C++14 | 487 ms | 51236 KB |
#include <cstdio> #include <set> #include <cstdlib> using namespace std; const int MAXN = 1e5+5; set<int> s[2][MAXN]; int l[MAXN], r[MAXN], u[MAXN], d[MAXN]; int n; void no(int id) { printf("NE\n"); exit(0); } int main() { scanf("%d", &n); for (int i = 0; i < n; ++i) { scanf("%d", l+i); if (l[i] == -1) continue; s[0][i].insert(l[i]); s[1][l[i]].insert(i); } for (int i = 0; i < n; ++i) { scanf("%d", r+i); if (r[i] == -1) continue; s[0][i].insert(n-r[i]-1); s[1][n-r[i]-1].insert(i); } for (int i = 0; i < n; ++i) { scanf("%d", u+i); if (u[i] == -1) continue; s[1][i].insert(u[i]); s[0][u[i]].insert(i); } for (int i = 0; i < n; ++i) { scanf("%d", d+i); if (d[i] == -1) continue; s[0][n-d[i]-1].insert(i); s[1][i].insert(n-d[i]-1); } /* for (int i = 0; i < 2; ++i) { printf("DIR :%d\n", i); for (int j = 0; j < n; ++j) { printf("j: %d\n", j); for (int k: s[i][j]) printf("%d ", k); printf("\n"); } printf("\n"); }*/ for (int i = 0; i < n; ++i) { if (l[i] == -1) { if (s[0][i].size() > 0) no(0); } else { if (s[0][i].size() == 0 || l[i] != *s[0][i].begin()) no(1); } if (u[i] == -1) { if (s[1][i].size() > 0) no(2); } else if (s[1][i].size() == 0 || u[i] != *s[1][i].begin()) no(3); if (r[i] == -1) { if (s[0][i].size() > 0) no(4); } else if (s[0][i].size() == 0 || r[i] != n-1-*(--s[0][i].end())) no(5); if (d[i] == -1) { if (s[1][i].size() > 0) no(6); } else if (s[1][i].size() == 0 || d[i] != n-1-*(--s[1][i].end())) no(7); } printf("DA\n"); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 10104 KB | Output is correct |
2 | Correct | 9 ms | 9720 KB | Output is correct |
3 | Correct | 11 ms | 10104 KB | Output is correct |
4 | Correct | 10 ms | 9720 KB | Output is correct |
5 | Correct | 11 ms | 10104 KB | Output is correct |
6 | Correct | 10 ms | 9720 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 10076 KB | Output is correct |
2 | Correct | 11 ms | 10104 KB | Output is correct |
3 | Correct | 12 ms | 10104 KB | Output is correct |
4 | Correct | 11 ms | 10104 KB | Output is correct |
5 | Correct | 11 ms | 10104 KB | Output is correct |
6 | Correct | 10 ms | 9720 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 163 ms | 20600 KB | Output is correct |
2 | Correct | 450 ms | 51236 KB | Output is correct |
3 | Correct | 478 ms | 51216 KB | Output is correct |
4 | Correct | 42 ms | 12408 KB | Output is correct |
5 | Correct | 487 ms | 51192 KB | Output is correct |
6 | Correct | 451 ms | 51236 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 365 ms | 47220 KB | Output is correct |
2 | Correct | 42 ms | 12536 KB | Output is correct |
3 | Correct | 416 ms | 51188 KB | Output is correct |
4 | Correct | 314 ms | 50172 KB | Output is correct |
5 | Correct | 332 ms | 51196 KB | Output is correct |
6 | Correct | 271 ms | 47096 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 139 ms | 20596 KB | Output is correct |
2 | Correct | 40 ms | 11256 KB | Output is correct |
3 | Correct | 378 ms | 51228 KB | Output is correct |
4 | Correct | 340 ms | 51192 KB | Output is correct |
5 | Correct | 357 ms | 51196 KB | Output is correct |
6 | Correct | 42 ms | 12536 KB | Output is correct |