//二分查找,要求数组必须有序,那也就是先排序再查找 #include<cstdio> #include<iostream> #include<algorithm> using namespace std; int a[100]; bool erfen(int n,int x) { int left=0; int right=n-1; int mid; while(left<=right) { mid=(left+right)/2; if(a[mid]==x) { return true; } else if(a[mid]<x) { left=mid+1; } else { right=mid-1; } } return false; } int main() { int n; int m; scanf("%d",&n); for(int i=0;i<n;i++) { scanf("%d",&a[i]); } sort(a,a+n); scanf("%d",&m); while(m--) { int x; scanf("%d",&x); if(erfen(n,x)) { printf("YES\n"); } else printf("NO\n"); } }