#include <bits/stdc++.h>
#define sz(x) int(x.size())
#define in(x) freopen(x, "r", stdin)
#define out(x) freopen(x, "w", stdout)
#define N 100500
#define oo ll(1e16)
#define ft first
#define sd second
#define pb push_back
#define ppb pop_back
#define el '\n'
#define elf endl
#define base ll(1e9 + 7)
using namespace std;
typedef long long ll;
typedef long double ld;
int n, a[2][N];
bool f = 1;
int main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
// in("input.txt");
cin >> n;
for (int i = 0; i < 2; i++)
for (int j = 0; j < n; j++)
cin >> a[i][j];
for (int i = 0; i < n; i++)
if (a[0][i] + a[1][i] > n || (min(a[0][i], a[1][i]) == -1 && max(a[0][i], a[1][i]) != -1))
f = 0;
for (int i = 0; i < 2; i++)
for (int j = 0; j < n; j++)
cin >> a[i][j];
for (int i = 0; i < n; i++)
if (a[0][i] + a[1][i] > n || (min(a[0][i], a[1][i]) == -1 && max(a[0][i], a[1][i]) != -1))
f = 0;
cout << (f ? "DA" : "NE");
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
6 ms |
256 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
43 ms |
1152 KB |
Output is correct |
2 |
Correct |
46 ms |
1144 KB |
Output is correct |
3 |
Correct |
43 ms |
1152 KB |
Output is correct |
4 |
Correct |
33 ms |
1152 KB |
Output is correct |
5 |
Correct |
47 ms |
1152 KB |
Output is correct |
6 |
Correct |
43 ms |
1144 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
40 ms |
1152 KB |
Output is correct |
2 |
Correct |
31 ms |
1152 KB |
Output is correct |
3 |
Correct |
46 ms |
1152 KB |
Output is correct |
4 |
Correct |
36 ms |
1144 KB |
Output is correct |
5 |
Correct |
46 ms |
1144 KB |
Output is correct |
6 |
Correct |
38 ms |
1152 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
42 ms |
1152 KB |
Output is correct |
2 |
Correct |
33 ms |
1152 KB |
Output is correct |
3 |
Correct |
46 ms |
1152 KB |
Output is correct |
4 |
Correct |
46 ms |
1152 KB |
Output is correct |
5 |
Correct |
47 ms |
1144 KB |
Output is correct |
6 |
Correct |
35 ms |
1152 KB |
Output is correct |