# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
750622 |
2023-05-30T01:26:27 Z |
Trunkty |
Kocka (COCI18_kocka) |
C++14 |
|
85 ms |
19496 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
int n;
int l[100005],r[100005],u[100005],d[100005];
set<int> s[100005];
signed main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cin >> n;
for(int i=1;i<=n;i++){
cin >> l[i];
}
for(int i=1;i<=n;i++){
cin >> r[i];
}
for(int i=1;i<=n;i++){
cin >> u[i];
}
for(int i=1;i<=n;i++){
cin >> d[i];
}
for(int i=1;i<=n;i++){
if(l[i]==-1 and r[i]==-1){
continue;
}
else if(l[i]==-1 or r[i]==-1){
cout << "NE" << "\n";
return 0;
}
else if(l[i]+r[i]>=n){
cout << "NE" << "\n";
return 0;
}
}
for(int i=1;i<=n;i++){
if(u[i]==-1 and d[i]==-1){
continue;
}
else if(u[i]==-1 or d[i]==-1){
cout << "NE" << "\n";
return 0;
}
else if(u[i]+d[i]>=n){
cout << "NE" << "\n";
return 0;
}
}
for(int i=1;i<=n;i++){
if(u[i]!=-1){
s[u[i]+1].insert(i);
s[n-d[i]].insert(i);
}
}
for(int i=1;i<=n;i++){
if(l[i]==-1){
if(!s[i].empty()){
cout << "NE" << "\n";
return 0;
}
}
else{
if(s[i].empty()){
cout << "NE" << "\n";
return 0;
}
int x = *s[i].begin(), y = *prev(s[i].end());
if(x!=l[i]+1 or y!=n-r[i]){
cout << "NE" << "\n";
return 0;
}
}
}
cout << "DA" << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
5120 KB |
Output is correct |
2 |
Correct |
3 ms |
5076 KB |
Output is correct |
3 |
Correct |
3 ms |
5036 KB |
Output is correct |
4 |
Correct |
3 ms |
5076 KB |
Output is correct |
5 |
Correct |
3 ms |
5076 KB |
Output is correct |
6 |
Correct |
3 ms |
5032 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
5076 KB |
Output is correct |
2 |
Incorrect |
3 ms |
5076 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
53 ms |
14088 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
85 ms |
19496 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
51 ms |
14156 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |