fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. ios::sync_with_stdio(false);
  6. cin.tie(nullptr);
  7.  
  8. int T;
  9. cin >> T;
  10. while (T--) {
  11. int N;
  12. cin >> N;
  13. vector<int> A(N);
  14. for (int i = 0; i < N; ++i) cin >> A[i];
  15.  
  16. int OR = 0;
  17. for (int x : A) OR |= x;
  18.  
  19. int highestBit = 0;
  20. for (int b = 30; b >= 0; --b)
  21. if ((OR >> b) & 1) {
  22. highestBit = 1 << b;
  23. break;
  24. }
  25.  
  26. int xorSum = 0;
  27. for (int x : A) {
  28. if (x & highestBit)
  29. xorSum ^= (x - highestBit); // OR 유지 가능한 제거량
  30. }
  31.  
  32. cout << (xorSum ? "Alice" : "Bob") << '\n';
  33. }
  34. }
Success #stdin #stdout 0s 5320KB
stdin
4
3
3 4 6
3
7 7 7
3
9 3 5
10
1 9 1 3 7 9 10 9 7 3
stdout
Alice
Alice
Alice
Alice