#include <iostream>
using namespace std;
bool hashTable[100000000];//哈希表,下标等于查找的值,有为true 没有为false
int main() {
int n, m;
cin >> n;
int a[100];
for (int i = 0; i < n; ++i) {
cin >> a[i];
hashTable[a[i]] = true;//有把,对应元素下标值设为true
}
cin >> m;
for (int i = 0; i < m; ++i) {
int target;
cin>>target;
if(hashTable[target]){//判断是否有
std::cout<<"YES"<<std::endl;
}else{
std::cout<<"NO"<<std::endl;
}
}
}

京公网安备 11010502036488号