fork download
  1. #include <bits/stdc++.h>
  2. #define ll long long
  3. #define ld long double
  4. #define nl "\n"
  5. #define OO 0x3f3f3f3f
  6. using namespace std;
  7. const int dx[] = {0, 0, 1, -1, -1, -1, 1, 1};
  8. const int dy[] = {1, -1, 0, 0, 1, -1, 1, -1};
  9. const int N = 1e5 + 5, M = 2e5 + 5;
  10. void ta2to2a()
  11. {
  12. ios_base::sync_with_stdio(false), cout.tie(nullptr), cin.tie(nullptr);
  13. #ifndef ONLINE_JUDGE
  14. freopen("input.txt", "r", stdin);
  15. freopen("output.txt", "w", stdout);
  16. #endif
  17. }
  18. void solve()
  19. {
  20. int n, k;
  21. cin >> n >> k;
  22. vector<ll> a(n);
  23. for (int i = 0; i < n; i++)
  24. {
  25. cin >> a[i];
  26. }
  27. vector<ll> suff(n + 1);
  28. suff[n] = 0;
  29. ll sum = 0;
  30. for (int i = n - 1; i >= 0; i--)
  31. {
  32. suff[i] = a[i] + sum;
  33. sum += suff[i];
  34. }
  35. ll turns = 0;
  36. for (int i = 0; i < n; i++)
  37. {
  38. if (i + k + 1 < n)
  39. {
  40. turns += suff[i] - suff[i + k + 1];
  41. }
  42. else
  43. {
  44. turns += suff[i];
  45. }
  46. }
  47. cout << turns << nl;
  48. if (turns % 2 == 0)
  49. {
  50. cout << "Bob" << nl;
  51. }
  52. else
  53. {
  54. cout << "Alice" << nl;
  55. }
  56. }
  57. int main()
  58. {
  59. ta2to2a();
  60. int t = 1;
  61. cin >> t;
  62. while (t--)
  63. {
  64. solve();
  65. }
  66. }
Success #stdin #stdout 0s 544KB
stdin
Standard input is empty
stdout
0
Bob