Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- // Comment int in case using pbds
- #define ll long long
- #define int long long
- // LOOPS
- #define each(a, x) for (auto &a : x)
- // STL
- template<class T> using min_heap = priority_queue<T, std::vector<T>, std::greater<T>>;
- template<class T> using max_heap = priority_queue<T, std::vector<T>>;
- #define all(x) begin(x), end(x)
- #define sor(x) sort(all(x))
- inline int nxt() {
- int x;
- cin >> x;
- return x;
- }
- void solve() {
- int n;
- cin >> n;
- vector<int> A(26, 0);
- string s;
- cin >> s;
- each(x, s) {
- A[x-'a']++;
- }
- int a = 0, b = 0, curr = 0, turn = 0;
- while (curr < 26) {
- if (turn) {
- b += A[curr];
- } else
- a += A[curr];
- curr = max_element(A.begin() + curr + 1, A.end()) - A.begin();
- turn ^= 1;
- }
- if (a == b) {
- cout << "Draw\n";
- } else if (a > b) {
- cout << "Alice\n";
- } else {
- cout << "Bob\n";
- }
- }
- int32_t main() {
- ios_base::sync_with_stdio(false);
- cin.tie(NULL);
- int T = 1;
- cin >> T;
- for (int i = 0; i < T; ++i) {
- solve();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement