mhdew

Binary Queries

Oct 7th, 2018
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define scan(x)     scanf("%lld", &x)
  6.  
  7. int main()
  8. {
  9.     long long n, q;
  10.     scan(n);
  11.     scan(q);
  12.     long long a[n+2];
  13.     for(int i=1;i<=n;i++){
  14.         scan(a[i]);
  15.     }
  16.     while(q--){
  17.         long long t;
  18.         long long pos, l, r;
  19.         scan(t);
  20.         if(t==1){
  21.             scan(pos);
  22.             if(a[pos]==0) a[pos]=1;
  23.             else a[pos]=0;
  24.         }
  25.         else{
  26.             scan(l);
  27.             scan(r);
  28.             if(a[r]==1) printf("ODD\n");
  29.             else printf("EVEN\n");
  30.         }
  31.     }
  32.  
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment