#include<cstdio>#include<algorithm>usingnamespace std;int arr[100];//boolbinarySearch(int n,int x){//查到了 返回True 否则返回falseint left =0;int right = n-1;while(left <= right){int mid =(left + right)/2;if(arr[mid]== x){returntrue;}elseif(arr[mid]> x){
right = mid -1;}else{
left = mid +1;}}returnfalse;}intmain(){int n,m;while(scanf("%d",&n)!=EOF){for(int i =0; i < n;++i){scanf("%d",&arr[i]);}sort(arr,arr+n);//排序scanf("%d",&m);//读取数据的数量for(int i =0; i < m;++i){int x;scanf("%d",&x);//每次读取的数据if(binarySearch(n,x)){printf("YES\n");}else{printf("NO\n");}}}}