#include <iostream>
using namespace std;
int L[100004],R[100004],U[100004],D[100004];
int main(){
int N,x;
string rj="DA";
cin >> N;
for (int i=0;i<N;i++){
cin >> x;
L[i]=x;
}
for (int i=0;i<N;i++){
cin >> x;
R[i]=x;
}
for (int i=0;i<N;i++){
cin >> x;
U[i]=x;
}
for (int i=0;i<N;i++){
cin >> x;
D[i]=x;
}
for (int i=0;i<N;i++){
if ((L[i]==-1 && R[i]!=-1) || (R[i]==-1 && L[i]!=-1) || L[i]+R[i]>=N){
rj="NE";
break;
}
if ((U[i]==-1 && D[i]!=-1) || (D[i]==-1 && U[i]!=-1) || U[i]+D[i]>=N){
rj="NE";
break;
}
}
cout << rj;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
376 KB |
Output is correct |
2 |
Correct |
4 ms |
376 KB |
Output is correct |
3 |
Correct |
4 ms |
504 KB |
Output is correct |
4 |
Correct |
18 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
4 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
408 KB |
Output is correct |
2 |
Correct |
3 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
372 KB |
Output is correct |
4 |
Correct |
5 ms |
376 KB |
Output is correct |
5 |
Correct |
3 ms |
376 KB |
Output is correct |
6 |
Correct |
4 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
178 ms |
3804 KB |
Output is correct |
2 |
Correct |
205 ms |
4252 KB |
Output is correct |
3 |
Correct |
209 ms |
4216 KB |
Output is correct |
4 |
Correct |
126 ms |
3132 KB |
Output is correct |
5 |
Correct |
201 ms |
4316 KB |
Output is correct |
6 |
Correct |
209 ms |
4440 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
197 ms |
3952 KB |
Output is correct |
2 |
Correct |
128 ms |
3036 KB |
Output is correct |
3 |
Correct |
202 ms |
4280 KB |
Output is correct |
4 |
Correct |
136 ms |
3128 KB |
Output is correct |
5 |
Correct |
198 ms |
4216 KB |
Output is correct |
6 |
Correct |
185 ms |
3960 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
175 ms |
3816 KB |
Output is correct |
2 |
Correct |
129 ms |
3116 KB |
Output is correct |
3 |
Correct |
200 ms |
4168 KB |
Output is correct |
4 |
Correct |
201 ms |
4392 KB |
Output is correct |
5 |
Correct |
203 ms |
4216 KB |
Output is correct |
6 |
Correct |
134 ms |
3036 KB |
Output is correct |