이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
# | 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... |