priyam2k

MINIAND

Jan 11th, 2020
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.20 KB | None | 0 0
  1. #include "bits/stdc++.h"
  2. #include <ext/pb_ds/assoc_container.hpp>
  3. #include <ext/pb_ds/tree_policy.hpp>
  4.  
  5. typedef long long ll;
  6. using namespace __gnu_pbds;
  7. using namespace std;
  8.  
  9. #define pb push_back
  10. #define mp make_pair
  11. #define eb emplace_back
  12. #define ff first
  13. #define ss second
  14. #define len(v) ((int)v.size())
  15. #define all(v) v.begin(), v.end()
  16. #define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
  17.  
  18. ll mod=998244353;
  19.  
  20. void io(){
  21.     ios_base::sync_with_stdio(false);
  22.     cin.tie(NULL);
  23.     cout.tie(NULL);
  24.    
  25. }
  26. const int N = 1e6 + 5;
  27. int main() {
  28.     io();
  29.     int t;
  30.     cin>>t;
  31.     assert(t <= 10);
  32.     while(t--){
  33.         int n;
  34.         cin>>n;
  35.         int a[n],f[n];
  36.         memset(f,0,sizeof(f));
  37.         for(int i=1;i<=n;i++){
  38.             cin>>a[i];
  39.             if(a[i] % 2 == 0)
  40.                 f[i] = 1;
  41.         }
  42.         for(int i=1;i<=n;i++){
  43.             f[i] += f[i-1];
  44.         }
  45.  
  46.         int q;
  47.         cin>>q;
  48.         while(q--){
  49.             int l,r;
  50.             cin>>l>>r;
  51.             if(f[r] - f[l-1] >= 1)
  52.                     cout<<"EVEN\n";
  53.             else  
  54.                 cout<<"ODD\n";
  55.         }  
  56.  
  57.  
  58.     }
  59. }
Add Comment
Please, Sign In to add comment