Emiliatan

b844

Feb 21st, 2019
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. /* b844             */
  2. /* AC (0.1s, 2.2MB) */
  3.  
  4. #include <bits/stdc++.h>
  5.  
  6. using namespace std;
  7.  
  8. int N,Q;
  9. vector<int> K(500001);
  10.  
  11. int main()
  12. {
  13.     while(~scanf("%d %d", &N, &Q))
  14.     {
  15.         for(int i = 0; i < N; i++) scanf("%d", &K[i]);
  16.  
  17.         sort(K.begin(), K.begin() + N);
  18.  
  19.         for(int i = 0, x; i < Q && scanf("%d", &x); i++)
  20.         {
  21.             auto it = upper_bound(K.begin(), K.begin() + N, x);
  22.             putchar(((it - K.begin()) & 1 )+ '0');
  23.             putchar('\n');
  24.         }
  25.     }
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment