fork download
  1.  
  2. import java.util.*;
  3. import java.lang.*;
  4. import java.io.*;
  5.  
  6. class Ideone
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. Scanner sc = new Scanner(System.in);
  11. int t = sc.nextInt();
  12. for(int i=0;i<t;i++){
  13. int n = sc.nextInt();
  14. int k = sc.nextInt();
  15. for(int j=0;j<n;j++){
  16. int num = sc.nextInt();
  17. if(num==k){
  18. k=0;
  19. }
  20. }
  21. if(k==0){
  22. System.out.println("YES");
  23. }
  24. else{
  25. System.out.println("NO");
  26. }
  27. }
  28. }
  29. }
Success #stdin #stdout 0.12s 56520KB
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