結果

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int X,Y,K,P;
  cin>>X>>Y>>K>>P;
  int beki[2]={1,-1};
  auto ans=[](int a){
    if(a==0)cout<<"Alice\n";
    else cout<<"Bob\n";
  };
  if((X+Y-K)%2){
    int T=(X+Y-K)/2;
    if(X<=T&&beki[K%2]!=P){
      ans(1);
      return 0;
    }
    if(Y<=T&&P!=1){
      ans(1);
      return 0;
    }
    if(X-1<=T&&beki[K%2]!=P&&Y-1<=T&&P!=1){
      ans(1);
      return 0;
    }
    ans(0);
    return 0;
  }else{
    int T=(X+Y-K)/2;
    if(X<=T&&beki[K%2]==P){
      ans(0);
      return 0;
    }
    if(Y<=T&&P==1){
      ans(0);
      return 0;
    }
    ans(1);
    return 0;
  }
}
0