#include <bits/stdc++.h>
using namespace std;
#define int long long
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);
#define OYY 1000000005
#define mod 998244353
int l[100000],r[100000],u[100000],d[100000];
int32_t main(){
faster
int n;cin>>n;
for(int i=0;i<n;i++){
cin>>l[i];
}
for(int i=0;i<n;i++){
cin>>r[i];
}
for(int i=0;i<n;i++){
cin>>u[i];
}
for(int i=0;i<n;i++){
cin>>d[i];
}
//////////////////////////////////////
bool stop=true;
for(int i=0;i<n && stop;i++){
//cout<<l[i]<<" "<<r[i]<<endl;
if(l[i]==-1 && r[i]==-1)continue;
if(l[i]==-1 || r[i]==-1){
// cout<<"y"<<endl;
stop=0;
break;
}
if(l[i]+r[i]<n)continue;
stop=0;
break;
}
//cout<<stop<<endl;
for(int i=0;i<n && stop;i++){
if(u[i]==-1 && d[i]==-1)continue;
if(u[i]==-1 || d[i]==-1){
stop=0;break;
}
if(u[i]+d[i]<n)continue;
stop=0;
break;
}
if(stop)cout<<"DA"<<'\n';
else cout<<"NE"<<'\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
276 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
544 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
24 ms |
5236 KB |
Output is correct |
2 |
Correct |
24 ms |
5724 KB |
Output is correct |
3 |
Correct |
30 ms |
5720 KB |
Output is correct |
4 |
Correct |
18 ms |
4500 KB |
Output is correct |
5 |
Correct |
24 ms |
5616 KB |
Output is correct |
6 |
Correct |
24 ms |
5692 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
26 ms |
5420 KB |
Output is correct |
2 |
Correct |
18 ms |
4544 KB |
Output is correct |
3 |
Correct |
24 ms |
5672 KB |
Output is correct |
4 |
Correct |
29 ms |
4692 KB |
Output is correct |
5 |
Correct |
23 ms |
5696 KB |
Output is correct |
6 |
Correct |
24 ms |
5464 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
24 ms |
5308 KB |
Output is correct |
2 |
Correct |
18 ms |
4564 KB |
Output is correct |
3 |
Correct |
27 ms |
5708 KB |
Output is correct |
4 |
Correct |
23 ms |
5708 KB |
Output is correct |
5 |
Correct |
24 ms |
5696 KB |
Output is correct |
6 |
Correct |
23 ms |
4540 KB |
Output is correct |