# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
147238 | 2019-08-28T13:26:37 Z | MatesV13 | Kocka (COCI18_kocka) | C++11 | 145 ms | 17016 KB |
#include <bits/stdc++.h> using namespace std; int n, a[5][100000]; 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++){ int mini = 1001; 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++){ int 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++){ int mini = 1001; 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++){ int 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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 5240 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 | 5132 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 5240 KB | Output is correct |
2 | Correct | 7 ms | 5112 KB | Output is correct |
3 | Correct | 7 ms | 5112 KB | Output is correct |
4 | Correct | 7 ms | 5240 KB | Output is correct |
5 | Correct | 7 ms | 5116 KB | Output is correct |
6 | Correct | 6 ms | 5112 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 128 ms | 13644 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 145 ms | 17016 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 124 ms | 13560 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |