#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int n, m, p[3][maxn], q[3][maxn];
int main() {
ios::sync_with_stdio(0), cin.tie(0);
cin >> n >> m;
for (int i : {0, 1, 2}) {
for (int j = 1; j <= n; j++) {
cin >> p[i][j], q[i][p[i][j]] = j;
}
}
while (m--) {
int op, x, y, z;
cin >> op >> x;
if (op == 1) {
bool flag = 1;
int mx = 0;
for (int i = 1; i < q[0][x]; i++) {
for (int j : {1, 2}) {
mx = max(mx, q[0][p[j][i]]);
}
if (mx == i) { flag = 0; break; }
}
cout << (flag ? "DA\n" : "NE\n");
} else {
cin >> y >> z, x--;
swap(p[x][q[x][y]], p[x][q[x][z]]), swap(q[x][y], q[x][z]);
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
0 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 |
340 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 |
0 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 |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 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 |
0 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 |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
22 ms |
2636 KB |
Output is correct |
14 |
Correct |
24 ms |
2600 KB |
Output is correct |
15 |
Correct |
25 ms |
2644 KB |
Output is correct |
16 |
Correct |
32 ms |
2548 KB |
Output is correct |
17 |
Correct |
34 ms |
2544 KB |
Output is correct |
18 |
Correct |
22 ms |
2644 KB |
Output is correct |
19 |
Correct |
25 ms |
2564 KB |
Output is correct |
20 |
Correct |
25 ms |
2704 KB |
Output is correct |
21 |
Correct |
22 ms |
2644 KB |
Output is correct |
22 |
Correct |
21 ms |
2548 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1084 ms |
2684 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
0 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 |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
22 ms |
2636 KB |
Output is correct |
14 |
Correct |
24 ms |
2600 KB |
Output is correct |
15 |
Correct |
25 ms |
2644 KB |
Output is correct |
16 |
Correct |
32 ms |
2548 KB |
Output is correct |
17 |
Correct |
34 ms |
2544 KB |
Output is correct |
18 |
Correct |
22 ms |
2644 KB |
Output is correct |
19 |
Correct |
25 ms |
2564 KB |
Output is correct |
20 |
Correct |
25 ms |
2704 KB |
Output is correct |
21 |
Correct |
22 ms |
2644 KB |
Output is correct |
22 |
Correct |
21 ms |
2548 KB |
Output is correct |
23 |
Execution timed out |
1084 ms |
2684 KB |
Time limit exceeded |
24 |
Halted |
0 ms |
0 KB |
- |