#include<cstdio> #include<algorithm> using namespace std; int arr[100];//使用全局数组 bool binarySearch(int n, int x) { int left = 0; int right = n - 1; while (left <= right) { int mid = (left + right) / 2; if (arr[mid] == x) { return true; } else if (arr[mid] > x) { right = mid - 1 ; } else { left = mid + 1 ; } } return false; } int main() { 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) == true) { printf("YES\n"); } else { printf("NO\n"); } } } }