#include<cstdio>
#include<map>
using namespace std;
int main(){
map<int,int>findIndex;
int m,n;
int arr[200];
while (scanf("%d",&n) != EOF){
for (int i = 0; i < n; ++i){
scanf("%d",&arr[i]);
findIndex[arr[i]] = i;//将数组的元素作为键,数组元素的下标作为值,插入map中
}
scanf("%d",&m);
for (int i = 0; i < m; ++i){
int findNum;//带查找的元素
scanf("%d",&findNum);
//find函数会返回找到那个元素的迭代器
if(findIndex.find(findNum)==findIndex.end()){
printf("NO\n");
}
else{
printf("YES\n");
}
}
}
}

京公网安备 11010502036488号