(String[] args)
| 36 | } |
| 37 | //Main function |
| 38 | public static void main (String[] args) throws java.lang.Exception |
| 39 | { |
| 40 | Scanner sc=new Scanner(System.in); |
| 41 | long n=sc.nextLong(); |
| 42 | long q=sc.nextLong(); |
| 43 | long [] arr=new long[(int)n]; |
| 44 | for(long a=0;a<n;a++) |
| 45 | arr[(int)a]=sc.nextLong(); |
| 46 | Arrays.sort(arr); //Sorting of array |
| 47 | for(long b=0;b<q;b++) |
| 48 | { |
| 49 | long x=sc.nextLong(); |
| 50 | long y=lower_bound(arr,n,x); //Function call to find out how many |
| 51 | if(y<n && arr[(int)y]==x) |
| 52 | System.out.println("0"); //printing zero if X == anyone root |
| 53 | else if(y%2==0) //checking whether number of elements greater than root are even or odd |
| 54 | System.out.println("POSITIVE"); //if number of elements greater than root are even |
| 55 | else |
| 56 | System.out.println("NEGATIVE"); //if number of elements greater than root are odd |
| 57 | } |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | /* |
nothing calls this directly
no test coverage detected