fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  4. typedef long long ll;
  5. using pii = pair<int, int>;
  6. const int N = 1000006;
  7.  
  8.  
  9. int dp[N], cxor[N];
  10.  
  11. void pre_calc(int n) {
  12. for (int i = 1; i <= n; i++) {
  13. for (int j = i; j <= n; j += i) {
  14. dp[j]++;
  15. }
  16. }
  17.  
  18. for (int i = 1; i <= n; i++) {
  19. cxor[i] = cxor[i - 1] ^ dp[i];
  20. }
  21. }
  22.  
  23. int main()
  24. {
  25.  
  26.  
  27. FASTIO
  28.  
  29. int n = 1000000;
  30. pre_calc(n);
  31. int q;
  32. cin >> q;
  33. assert(q <= 100000);
  34. while (q--) {
  35. int l, r;
  36. cin >> l >> r;
  37. assert(l <= r);
  38. assert(l > 0 && r <= n);
  39. if ((cxor[r] ^ cxor[l - 1]) > 0)
  40. cout << "Alice\n";
  41. else cout << "Bob\n";
  42. }
  43. }
Success #stdin #stdout 0.03s 11300KB
stdin
Standard input is empty
stdout
Standard output is empty