#include <cstdio>
#include <algorithm>
//加入map
#include <map>
using namespace std;
//进行元素映射
map<int, int> mapping;
int arr[200];
int main() {
//n为数组长度
//m为查找个数
int n, m;
while (scanf("%d", &n) != EOF) {
for (int i = 0; i < n; i++) {
scanf("%d", &arr[i]);
mapping[arr[i]] = i;
}
scanf("%d", &m);
for (int i = 0; i < m; i++) {
int key;
scanf("%d", &key);
//在map中查找key,如果没找到则为end()
if(mapping.find(key) == mapping.end()){
printf("NO\n");
}else{
printf("YES\n");
}
}
}
}

京公网安备 11010502036488号