# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
116006 |
2019-06-10T07:11:55 Z |
Vlatko |
Kocka (COCI18_kocka) |
C++14 |
|
542 ms |
51408 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int main() {
ios::sync_with_stdio(false); cin.tie(0);
int n;
cin >> n;
vector<int> L(n+1), R(n+1), U(n+1), D(n+1);
vector<set<int>> m(n+1), k(n+1);
vector<bool> me(n+1, false), ke(n+1, false);
for (int i = 1; i <= n; ++i) {
cin >> L[i];
if (L[i] == -1) {
me[i] = true;
} else {
m[i].insert(L[i]+1);
k[L[i]+1].insert(i);
}
}
for (int i = 1; i <= n; ++i) {
cin >> R[i];
if (R[i] == -1) {
me[i] = true;
} else {
m[i].insert(n-R[i]);
k[n-R[i]].insert(i);
}
}
for (int i = 1; i <= n; ++i) {
cin >> U[i];
if (U[i] == -1) {
ke[i] = true;
} else {
m[U[i]+1].insert(i);
k[i].insert(U[i]+1);
}
}
for (int i = 1; i <= n; ++i) {
cin >> D[i];
if (D[i] == -1) {
ke[i] = true;
} else {
m[n-D[i]].insert(i);
k[i].insert(n-D[i]);
}
}
for (int i = 1; i <= n; ++i) {
if (me[i] && !m[i].empty()) {
cout << "NE"; return 0;
}
if (ke[i] && !k[i].empty()) {
cout << "NE"; return 0;
}
if (!me[i] && *m[i].begin() != L[i]+1) {
cout << "NE"; return 0;
}
if (!me[i] && *prev(m[i].end()) != n-R[i]) {
cout << "NE"; return 0;
}
if (!ke[i] && *k[i].begin() != U[i]+1) {
cout << "NE"; return 0;
}
if (!ke[i] && *prev(k[i].end()) != n-D[i]) {
cout << "NE"; return 0;
}
}
cout << "DA" << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
896 KB |
Output is correct |
2 |
Correct |
2 ms |
512 KB |
Output is correct |
3 |
Correct |
4 ms |
896 KB |
Output is correct |
4 |
Correct |
2 ms |
512 KB |
Output is correct |
5 |
Correct |
4 ms |
896 KB |
Output is correct |
6 |
Correct |
2 ms |
392 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
896 KB |
Output is correct |
2 |
Correct |
3 ms |
768 KB |
Output is correct |
3 |
Correct |
4 ms |
768 KB |
Output is correct |
4 |
Correct |
3 ms |
768 KB |
Output is correct |
5 |
Correct |
4 ms |
896 KB |
Output is correct |
6 |
Correct |
2 ms |
512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
159 ms |
22520 KB |
Output is correct |
2 |
Correct |
436 ms |
51228 KB |
Output is correct |
3 |
Correct |
437 ms |
51320 KB |
Output is correct |
4 |
Correct |
38 ms |
12664 KB |
Output is correct |
5 |
Correct |
449 ms |
51320 KB |
Output is correct |
6 |
Correct |
477 ms |
51316 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
418 ms |
47456 KB |
Output is correct |
2 |
Correct |
39 ms |
12664 KB |
Output is correct |
3 |
Correct |
446 ms |
51408 KB |
Output is correct |
4 |
Correct |
315 ms |
50168 KB |
Output is correct |
5 |
Correct |
457 ms |
51316 KB |
Output is correct |
6 |
Correct |
397 ms |
47316 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
169 ms |
22664 KB |
Output is correct |
2 |
Correct |
39 ms |
12536 KB |
Output is correct |
3 |
Correct |
469 ms |
51232 KB |
Output is correct |
4 |
Correct |
542 ms |
51380 KB |
Output is correct |
5 |
Correct |
454 ms |
51284 KB |
Output is correct |
6 |
Correct |
42 ms |
12664 KB |
Output is correct |