# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
86098 | ffrich | Kocka (COCI18_kocka) | C++11 | 166 ms | 2208 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
using namespace std;
int a[100001],b[100001],c[100001],d[100001];
int main (){
int n;
cin >> n;
for(int i=0;i<n;i++){
cin >> a[i];
}
for(int i=0;i<n;i++){
cin >> b[i];
}
for(int i=0;i<n;i++){
cin >> c[i];
}
for(int i=0;i<n;i++){
cin >> d[i];
}
int t=1;
for(int i=0;i<n;i++){
if(a[i]==-1 and b[i]==-1 or a[i]<=(n-b[i]-1) and c[a[i]]<=i and d[a[i]]<=(n-i-1) and c[a[i]]!=-1 and d[a[i]]!=-1 and a[i]!=-1 and b[i]!=-1){
continue;
}
else{
t=0;
break;
}
}
if(t==0){
cout << "NE";
return 0;
}
for(int i=0;i<n;i++){
if(c[i]==-1 and d[i]==-1 or c[i]<=(n-d[i]-1) and a[c[i]]<=i and b[c[i]]<=(n-i-1) and a[c[i]]!=-1 and a[c[i]]!=-1 and c[i]!=-1 and d[i]!=-1){
continue;
}
else{
t=0;
break;
}
}
if(t==0){
cout << "NE";
return 0;
}
if(t==1){
cout << "DA";
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |