fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. // your code goes here
  13. Scanner sc = new Scanner(System.in);
  14. int t =sc.nextInt();
  15. for(int i=0;i<t;i++){
  16. int n = sc.nextInt();
  17. int num1=0;
  18. int num2=0;
  19. for(int j=0;j<n;j++){
  20. int num=sc.nextInt();
  21. if(num==1){
  22. num1=1;
  23. }
  24. else if(num==67){
  25. num2=1;
  26. }
  27. }
  28. if(num1==1 && num2==1){
  29. System.out.println("YES");
  30. }
  31. else{
  32. System.out.println("NO");
  33. }
  34. }
  35. }
  36. }
Success #stdin #stdout 0.19s 54536KB
stdin
2
5
1 7 6 7 67
5
1 3 5 7 8
stdout
YES
NO