Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
938 B
0
Indexable
Never
#pragma GCC optimize("O2,no-stack-protector,unroll-loops")
#define ll long long
#define pb push_back
#define ipar(arr, n) vector<ll> arr(n); for(int i=0;i<n;i++) cin>>arr[i];
#include <cmath>
#include <bits/stdc++.h>
#define pii pair<int, int>
#define pll pair<ll, ll>
using namespace std;


void solve(){
    ll n;cin>>n;
    ipar(arr,n);
    ll odd=0,ev=0,on=0;
    for(auto i:arr){
        if(i==1) {on++; continue;}
        if(i%2==0) ev++;
        else odd++;
    }
    ll al=0,bob=0;
    bob+=on/2;
    al+=on-bob;
    if(on%2==0){ //alice turn
        if(odd%2==1) al+=ev+odd;
        else bob+=ev+odd;
    }
    else{// bobs turn
        if(odd%2==1) bob+=ev+odd;
        else al+=ev+odd;
        
    }
    if(al==bob) cout<<"Draw"<<"\n";
    else if(al>bob) cout<<"alice"<<"\n";
    else cout<<"bob\n";
}


signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int t;
	cin>>t;
	while(t--) solve();
}
Leave a Comment