Ankit_132

C

Dec 27th, 2023
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1.  
  2. #include <bits/stdc++.h>
  3.  
  4. using namespace std;
  5.  
  6. #define ll     long long
  7. #define _test   int _TEST; cin>>_TEST; while(_TEST--)
  8.  
  9. int main()
  10. {
  11.     _test
  12.     {
  13.         int n;
  14.         cin>>n;
  15.  
  16.         vector<ll int> a(n);
  17.         for(auto &e: a)     cin>>e;
  18.  
  19.         ll int tot = accumulate(a.begin(), a.end(), 0ll);
  20.  
  21.         if(n==1 && a[0]>=2)
  22.             cout<<"Alice\n";
  23.         else if(tot%2==1)
  24.             cout<<"Bob\n";
  25.         else
  26.         {
  27.             ll int x=0;
  28.             for(int i=0; i<n; i++)
  29.             {
  30.                 if(i%2)    
  31.                     x += a[i];
  32.             }
  33.  
  34.             if(x%2 != (tot/2)%2)
  35.                 cout<<"Alice\n";
  36.             else
  37.                 cout<<"Bob\n";
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment