結果

問題 No.2103 ±1s Game
ユーザー 👑 emthrmemthrm
提出日時 2022-10-21 22:00:29
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,767 bytes
コンパイル時間 2,103 ms
コンパイル使用メモリ 198,500 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-13 22:19:16
合計ジャッジ時間 3,363 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 1 ms
4,500 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 1 ms
4,376 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 2 ms
4,380 KB
testcase_33 AC 1 ms
4,376 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 2 ms
4,376 KB
testcase_36 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr double EPS = 1e-8;
constexpr int MOD = 998244353;
// constexpr int MOD = 1000000007;
constexpr int DY4[]{1, 0, -1, 0}, DX4[]{0, -1, 0, 1};
constexpr int DY8[]{1, 1, 0, -1, -1, -1, 0, 1};
constexpr int DX8[]{0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U>
inline bool chmax(T& a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U>
inline bool chmin(T& a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << fixed << setprecision(20);
  }
} iosetup;

bool solve(const int x, const int y, const int k, const int p) {
  if (x + y == k || k / 2 >= y) return (p == -1) == (y % 2 == 1);
  if ((k + 1) / 2 >= y) return true;
  if (k % 2 == 0) {
    if (p == -1) return k / 2 >= x && (k - x) % 2 == 0;
    return k / 2 >= x && (k - x) % 2 == 1;
  }
  if (p == -1) return !(k / 2 >= x && (k - x) % 2 == 0);
  return !(k / 2 >= x && (k - x) % 2 == 1);
}

int main() {
  // int dp[X][Y][K][2]{};
  // REP(i, X) REP(j, Y) {
  //   dp[i][j][0][true] = true;
  //   dp[i][j][0][false] = false;
  //   FOR(k, 1, K) fill(dp[i][j][k], dp[i][j][k] + 2, -1);
  // }
  // REP(i, X) REP(j, Y) for (int k = 1; k <= i + j && k < K; ++k) {
  //   dp[i][j][k][true] = false;
  //   if (i > 0 && !dp[i - 1][j][k - 1][false]) dp[i][j][k][true] = true;
  //   if (j > 0 && !dp[i][j - 1][k - 1][true]) dp[i][j][k][true] = true;
  //   dp[i][j][k][false] = false;
  //   if (i > 0 && !dp[i - 1][j][k - 1][true]) dp[i][j][k][false] = true;
  //   if (j > 0 && !dp[i][j - 1][k - 1][false]) dp[i][j][k][false] = true;
  //   if (i == 0 || j == 0) continue;
  //   if (i + j == k || k / 2 >= j) {
  //     assert(dp[i][j][k][false] == (j % 2 == 1) && dp[i][j][k][true] == (j % 2 == 0));
  //   } else if ((k + 1) / 2 >= j) {
  //     assert(dp[i][j][k][false] && dp[i][j][k][true]);
  //   } else if (k % 2 == 0) {
  //     assert(dp[i][j][k][false] == ((k + 1) / 2 >= i && (k - i) % 2 == 1) && dp[i][j][k][true] == ((k + 1) / 2 >= i && (k - i) % 2 == 0));
  //   } else {
  //     assert(dp[i][j][k][false] == !(k / 2 >= i && (k - i) % 2 == 0) && dp[i][j][k][true] == !(k / 2 >= i && (k - i) % 2 == 1));
  //   }
  //   // cout << i << ' ' << j << ' ' << k << ": " << dp[i][j][k][true] << ' ' << dp[i][j][k][false] << '\n';
  // }

  int x, y, k, p; cin >> x >> y >> k >> p;
  cout << (solve(x, y, x + y - k, p) ? "Alice\n" : "Bob\n");
  return 0;
}
0