Ankit_132

Break Free

Jun 7th, 2023
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5.    
  6.     int N = 2e5 + 5;
  7.     int MOD = 1e9 +7;
  8.     vector<long long int> pow2(N);
  9.     pow2[0] = 1;
  10.     for(int i=1; i<N; i++)
  11.         (pow2[i] = 2ll*pow2[i-1]) %= MOD;
  12.    
  13.     int t;
  14.     cin>>t;
  15.     while(t--)
  16.     {
  17.         int n;
  18.         cin>>n;
  19.        
  20.         vector<int> a(n);
  21.         for(auto &e: a)     cin>>e;
  22.        
  23.         int cntEven = 0;
  24.        
  25.         for(auto e: a)      cntEven += (e%2 == 0);
  26.        
  27.         cout<<(pow2[cntEven] - (cntEven==n))<<"\n";
  28.     }
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment