Code : Bucket Game
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
void solve(vector<int> &a) {
int n = a.size();
sort(a.begin(), a.end());
int alice = 0, bob = 0, alice_has_turn = true;
int even_cnt = 0;
for (int i = 0; i < n; i++) {
if (a[i] % 2 == 0) {
even_cnt++;
} else {
if (alice_has_turn) {
if (a[i] == 1) {
alice++;
} else {
even_cnt++;
}
} else {
if (a[i] == 1) {
bob++;
} else {
even_cnt++;
}
}
alice_has_turn = !alice_has_turn;
}
}
if (alice_has_turn) {
bob += even_cnt;
} else {
alice += even_cnt;
}
if (alice > bob) {
cout << "Alice" << endl;
} else if (bob > alice) {
cout << "Bob" << endl;
} else {
cout << "Draw" << endl;
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
for (int i = 0; i < t; i++) {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
solve(a);
}
}