Advertisement
Guest User

ruspa

a guest
Sep 10th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <iostream>
  3. #include <vector>
  4. #define MAXN 100000
  5. using namespace std;
  6.  
  7. int N, W[2];
  8. vector<int> M;
  9.  
  10. void inizia()
  11. {
  12.     W[0] = M[(N-1)/2];
  13.     W[1] = M[N/2];
  14. }
  15.  
  16. inline bool abbatti(int X, bool D)
  17. {
  18.     return (X<=W[D]);
  19. }
  20.  
  21. int main()
  22. {
  23.     int T, X;
  24.     bool D;
  25.     freopen("input.txt", "r", stdin);
  26.     freopen("output.txt", "w", stdout);
  27.     cin >> N >> T;
  28.     for(int i=0; i<N; i++)
  29.     {
  30.         int a;
  31.         cin >> a;
  32.         M.push_back(a);
  33.     }
  34.     inizia();
  35.     for(int i=0; i<T; i++)
  36.     {
  37.         cin >> X >> D;
  38.         cout << abbatti(X,D) << ' ';
  39.     }
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement