fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. bool find(int a[], int n, int k){
  4. for(int i = 0; i < n; i++){
  5. if(a[i] == k) return true;
  6. }
  7. return false;
  8. }
  9. int main(){
  10. int t;cin >> t;
  11. while(t--){
  12. int n;
  13. cin >> n;
  14. int k; cin >> k;
  15. int a[n];
  16. for(int i = 0; i < n; i++)cin >> a[i];
  17. if(find(a , n, k)) cout << "YES"<< endl;
  18. else cout << "NO"<< endl;
  19. }
  20. }
Success #stdin #stdout 0s 5272KB
stdin
Standard input is empty
stdout
Standard output is empty