# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
305496 | 2020-09-23T10:58:00 Z | phathnv | Kocka (COCI18_kocka) | C++11 | 65 ms | 4216 KB |
#include <bits/stdc++.h> #define mp make_pair #define X first #define Y second #define taskname "Kocka" using namespace std; typedef long long ll; typedef pair <int, int> ii; const int N = 1e5 + 1; int n, l[N], r[N], u[N], d[N]; void readInput(){ scanf("%d", &n); for(int i = 1; i <= n; i++) scanf("%d", &l[i]); for(int i = 1; i <= n; i++) scanf("%d", &r[i]); for(int i = 1; i <= n; i++) scanf("%d", &u[i]); for(int i = 1; i <= n; i++) scanf("%d", &d[i]); } bool construct(int l[], int r[]){ for(int i = 1; i <= n; i++) if (l[i] + r[i] == -2){ l[i] = -1; r[i] = -1; } else if (min(l[i], r[i]) > -1){ if (l[i] + r[i] >= n) return 0; l[i] = l[i] + 1; r[i] = n - r[i]; } else { return 0; } return 1; } bool check(int a[], int l[], int r[]){ for(int i = 1; i <= n; i++){ if (a[i] == -1) continue; if (i < l[a[i]] || r[a[i]] < i) return 0; } return 1; } void solve(){ if (!construct(l, r) || !construct(u, d)){ printf("NE"); return; } if (check(l, u, d) && check(r, u, d) && check(u, l, r) && check(d, l, r)) printf("DA"); else printf("NE"); } int main(){ //freopen(taskname".inp", "r", stdin); //freopen(taskname".out", "w", stdout); readInput(); solve(); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 1 ms | 304 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 512 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 65 ms | 3740 KB | Output is correct |
2 | Correct | 59 ms | 4200 KB | Output is correct |
3 | Correct | 58 ms | 4216 KB | Output is correct |
4 | Correct | 39 ms | 3064 KB | Output is correct |
5 | Correct | 58 ms | 4216 KB | Output is correct |
6 | Correct | 58 ms | 4216 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 59 ms | 3960 KB | Output is correct |
2 | Correct | 39 ms | 3064 KB | Output is correct |
3 | Correct | 58 ms | 4216 KB | Output is correct |
4 | Correct | 47 ms | 3192 KB | Output is correct |
5 | Correct | 59 ms | 4216 KB | Output is correct |
6 | Correct | 63 ms | 3960 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 58 ms | 3724 KB | Output is correct |
2 | Correct | 41 ms | 3192 KB | Output is correct |
3 | Correct | 58 ms | 4216 KB | Output is correct |
4 | Correct | 57 ms | 4216 KB | Output is correct |
5 | Correct | 59 ms | 4216 KB | Output is correct |
6 | Correct | 42 ms | 3064 KB | Output is correct |