結果

問題 No.2103 ±1s Game
ユーザー shoshoshom
提出日時 2022-10-21 22:23:02
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 824 bytes
コンパイル時間 1,827 ms
コンパイル使用メモリ 191,940 KB
最終ジャッジ日時 2025-02-08 10:14:33
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#ifdef SHO_LOCAL
#include "debug.h"
#else
#define debug(...)                                                             \
  {}
#endif
using namespace std;

void a() { cout << "Alice" << '\n'; }
void b() { cout << "Bob" << '\n'; }

int main() {
  iostream::sync_with_stdio(0), cin.tie(0), cout.tie(0);

  long long x, y, k, p;
  cin >> x >> y >> k >> p;

  long long t = x + y - k;
  bool one_way = x <= t / 2 || y <= t / 2;
  if (one_way) {
    if (x < y) {
      y -= t - x;
      x = 0;
    } else {
      x -= t - y;
      y = 0;
    }
    if (y == 0) {
      if (p == 1)
        a();
      else
        b();
    } else {
      if ((p == 1 && (y % 2 == 0)) || (p == -1 && (y & 1)))
        a();
      else
        b();
    }
  } else if (t & 1) {
    a();
  } else {
    b();
  }

  return 0;
}
0