# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
99375 | 2019-03-03T07:45:41 Z | kimcoding | Kocka (COCI18_kocka) | C++17 | 102 ms | 6004 KB |
#include <cstdio> #include <cstring> #define min(a,b) (a<b?a:b) int *cube[4], *now[4], n; int f(int i, int j, int val) { if (cube[i][j] > val || cube[i][j] == -1) return -2; return now[i][j] == -1 ? val : min(now[i][j], val); } bool solve() { for (int i = 0; i < 4; i++) { for (int j = 0; j < n; j++) { if (cube[i][j] == -1 || cube[i][j] == now[i][j]) continue; now[i][j] = cube[i][j]; now[i ^ 1][j] = f(i ^ 1, j, n - cube[i][j] - 1); int r = (i / 2 * 2 + 2) % 4, c = i & 1 ? n - cube[i][j] - 1 : cube[i][j]; now[r][c] = f(r, c, j); now[r + 1][c] = f(r + 1, c, n - j - 1); if (now[i ^ 1][j] == -2 || now[r][c] == -2 || now[r + 1][c] == -2) return false; } } return true; } int main() { scanf("%d", &n); for (int i = 0; i < 4; i++) { cube[i] = new int[n]; now[i] = new int[n]; memset(now[i], -1, sizeof(int) * n); } for (int i = 0; i < 4; i++) for (int j = 0; j < n; j++) scanf("%d", &cube[i][j]); printf("%s\n", solve() ? "DA" : "NE"); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 3 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 3 ms | 384 KB | Output is correct |
6 | Correct | 3 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | Output is correct |
2 | Correct | 3 ms | 384 KB | Output is correct |
3 | Correct | 3 ms | 384 KB | Output is correct |
4 | Correct | 4 ms | 384 KB | Output is correct |
5 | Correct | 3 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 69 ms | 3460 KB | Output is correct |
2 | Correct | 64 ms | 5752 KB | Output is correct |
3 | Correct | 53 ms | 5752 KB | Output is correct |
4 | Correct | 40 ms | 4728 KB | Output is correct |
5 | Correct | 92 ms | 5752 KB | Output is correct |
6 | Correct | 59 ms | 5752 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 63 ms | 3452 KB | Output is correct |
2 | Correct | 41 ms | 4592 KB | Output is correct |
3 | Correct | 58 ms | 5752 KB | Output is correct |
4 | Correct | 80 ms | 4728 KB | Output is correct |
5 | Correct | 74 ms | 6004 KB | Output is correct |
6 | Correct | 65 ms | 5468 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 69 ms | 3436 KB | Output is correct |
2 | Correct | 58 ms | 4700 KB | Output is correct |
3 | Correct | 76 ms | 5624 KB | Output is correct |
4 | Correct | 102 ms | 5936 KB | Output is correct |
5 | Correct | 58 ms | 5752 KB | Output is correct |
6 | Correct | 51 ms | 4728 KB | Output is correct |