# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
147239 | 2019-08-28T13:29:32 Z | MatesV13 | Kocka (COCI18_kocka) | C++11 | 203 ms | 17372 KB |
#include <bits/stdc++.h> using namespace std; int n, a[5][100000], maks, mini; vector<int> x[100005], y[100005]; int main (){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for (int i=0; i<n; i++){ cin >> a[1][i]; if (a[1][i]==-1) continue; x[i].push_back(a[1][i]); y[a[1][i]].push_back(i); } for (int i=0; i<n; i++){ cin >> a[2][i]; if (a[2][i]==-1) continue; a[2][i]= n-a[2][i]-1; x[i].push_back(a[2][i]); y[a[2][i]].push_back(i); } for (int i=0; i<n; i++){ cin >> a[3][i]; if (a[3][i]==-1) continue; y[i].push_back(a[3][i]); x[a[3][i]].push_back(i); } for (int i=0; i<n; i++){ cin >> a[4][i]; if (a[4][i]==-1) continue; a[4][i]= n-a[4][i]-1; y[i].push_back(a[4][i]); x[a[4][i]].push_back(i); } bool ok=1; for (int i=0;i<n;i++){ mini = 100001; if (x[i].empty()) mini=-1; for (int j=0; j<x[i].size();j++) mini = min (mini, x[i][j]); if (mini!=a[1][i]) ok=0; } for (int i=0;i<n;i++){ maks = -1; for (int j=0; j<x[i].size();j++) maks = max (maks, x[i][j]); if (maks!=a[2][i]) ok=0; } for (int i=0;i<n;i++){ mini = 100001; if (y[i].empty()) mini=-1; for (int j=0; j<y[i].size();j++) mini = min (mini, y[i][j]); if (mini!=a[3][i]) ok=0; } for (int i=0;i<n;i++){ maks = -1; for (int j=0; j<y[i].size();j++) maks = max (maks, y[i][j]); if (maks!=a[4][i]) ok=0; } if (ok) cout << "DA"; else cout << "NE"; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 5112 KB | Output is correct |
2 | Correct | 7 ms | 5112 KB | Output is correct |
3 | Correct | 7 ms | 5240 KB | Output is correct |
4 | Correct | 7 ms | 5112 KB | Output is correct |
5 | Correct | 7 ms | 5112 KB | Output is correct |
6 | Correct | 7 ms | 5112 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 5112 KB | Output is correct |
2 | Correct | 7 ms | 5240 KB | Output is correct |
3 | Correct | 7 ms | 5240 KB | Output is correct |
4 | Correct | 7 ms | 5112 KB | Output is correct |
5 | Correct | 7 ms | 5240 KB | Output is correct |
6 | Correct | 7 ms | 5112 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 133 ms | 13680 KB | Output is correct |
2 | Correct | 197 ms | 17244 KB | Output is correct |
3 | Correct | 180 ms | 17144 KB | Output is correct |
4 | Correct | 37 ms | 7800 KB | Output is correct |
5 | Correct | 187 ms | 17244 KB | Output is correct |
6 | Correct | 189 ms | 17372 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 151 ms | 17144 KB | Output is correct |
2 | Correct | 44 ms | 7800 KB | Output is correct |
3 | Correct | 203 ms | 17208 KB | Output is correct |
4 | Correct | 84 ms | 16376 KB | Output is correct |
5 | Correct | 199 ms | 17272 KB | Output is correct |
6 | Correct | 176 ms | 17032 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 129 ms | 13808 KB | Output is correct |
2 | Correct | 37 ms | 7800 KB | Output is correct |
3 | Correct | 164 ms | 17272 KB | Output is correct |
4 | Correct | 174 ms | 17272 KB | Output is correct |
5 | Correct | 188 ms | 17272 KB | Output is correct |
6 | Correct | 42 ms | 7868 KB | Output is correct |