fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define endl '\n'
  4. #define int long long
  5.  
  6. const int MOD = 1e9 + 7;
  7. const int INF = LLONG_MAX / 2;
  8.  
  9. signed main() {
  10. ios::sync_with_stdio(false);
  11. cin.tie(NULL);
  12.  
  13. int t;
  14. cin >> t;
  15. while (t--) {
  16. int n,k;
  17. cin>>n>>k;
  18. vector<int>arr(n);
  19. for(int i=0;i<n;i++){
  20. cin>>arr[i];
  21. }
  22. if(find(arr.begin(),arr.end(),k) == arr.end())cout<<"NO"<<endl;
  23. else cout<<"YES"<<endl;
  24. }
  25.  
  26. }
Success #stdin #stdout 0s 5256KB
stdin
7
5 4
1 4 3 4 1
4 1
2 3 4 4
5 6
43 5 60 4 2
2 5
1 5
4 1
5 3 3 1
1 3
3
5 3
3 4 1 5 5
stdout
YES
NO
NO
YES
YES
YES
YES