This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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){
mx_all = max(mx_all, mx[i]);
if(mx_all == i - 1){
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{
}
}
}
# | 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... |