이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int kNMax = 1e5 + 7;
int n, q;
int a[3][kNMax], mx[kNMax], pos[3][kNMax];
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cin >> n >> q;
for(int i = 0; i < 3; ++i){
for(int j = 1; j <= n; ++j){
cin >> a[i][j];
pos[i][a[i][j]] = j;
}
}
for(int i = 1; i <= n; ++i){
mx[i] = 0;
for(int j = 0; j < 3; ++j)
mx[i] = max(mx[i], pos[j][i]);
}
int border = -1, mx_all = 0;
for(int i = 1; i <= n; ++i){
int x = a[0][i];
mx_all = max(mx_all, mx[x]);
if(mx_all == i){
border = i;
break;
}
}
for(int i = 0; i < q; ++i){
int type;
cin >> type;
if(type == 1){
int x;
cin >> x;
if(mx[x] <= border)
cout << "DA\n";
else
cout << "NE\n";
}
else{
}
}
}
/*
4 2
1 2 3 4
2 1 3 4
2 4 3 1
1 1
1 4
*/
# | 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... |