Advertisement
Guest User

Untitled

a guest
Jan 7th, 2024
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. // Comment int in case using pbds
  5. #define ll long long
  6. #define int long long
  7.  
  8. // LOOPS
  9. #define each(a, x) for (auto &a : x)
  10.  
  11. // STL
  12. template<class T> using min_heap = priority_queue<T, std::vector<T>, std::greater<T>>;
  13. template<class T> using max_heap = priority_queue<T, std::vector<T>>;
  14. #define all(x) begin(x), end(x)
  15. #define sor(x) sort(all(x))
  16.  
  17.  
  18. inline int nxt() {
  19. int x;
  20. cin >> x;
  21. return x;
  22. }
  23.  
  24.  
  25. void solve() {
  26. int n;
  27. cin >> n;
  28. vector<int> A(26, 0);
  29. string s;
  30. cin >> s;
  31. each(x, s) {
  32. A[x-'a']++;
  33. }
  34. int a = 0, b = 0, curr = 0, turn = 0;
  35. while (curr < 26) {
  36. if (turn) {
  37. b += A[curr];
  38. } else
  39. a += A[curr];
  40. curr = max_element(A.begin() + curr + 1, A.end()) - A.begin();
  41. turn ^= 1;
  42. }
  43. if (a == b) {
  44. cout << "Draw\n";
  45. } else if (a > b) {
  46. cout << "Alice\n";
  47. } else {
  48. cout << "Bob\n";
  49. }
  50. }
  51.  
  52. int32_t main() {
  53. ios_base::sync_with_stdio(false);
  54. cin.tie(NULL);
  55. int T = 1;
  56. cin >> T;
  57. for (int i = 0; i < T; ++i) {
  58. solve();
  59. }
  60. return 0;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement