結果

問題 No.2103 ±1s Game
ユーザー risujiroh
提出日時 2022-10-21 22:29:00
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 641 bytes
コンパイル時間 2,717 ms
コンパイル使用メモリ 242,512 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-01 07:00:06
合計ジャッジ時間 3,811 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

void solve(std::istream& is, std::ostream& os) {
  int X, Y, K, P;
  is >> X >> Y >> K >> P;
  K = X + Y - K;
  if (Y & 1) {
    P = -P;
  }
  if (K & 1) {
    if ((X <= K / 2 && ((K - X) & 1 ? -1 : 1) != P) ||
        (Y <= K / 2 && (Y & 1 ? -1 : 1) != P)) {
      os << "Bob\n";
    } else {
      os << "Alice\n";
    }
  } else {
    if ((X <= K / 2 && ((K - X) & 1 ? -1 : 1) == P) ||
        (Y <= K / 2 && (Y & 1 ? -1 : 1) == P)) {
      os << "Alice\n";
    } else {
      os << "Bob\n";
    }
  }
}

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);

  solve(std::cin, std::cout);
}
0