結果

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

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 3000000000000000

int get(long long y){
	if(y%2==0)return 1;
	else return -1;
}
int main(){
	
	long long X,Y,K,P;
	cin>>X>>Y>>K>>P;
	long long turns = X+Y-K;
	
	long long need = 0;
	if(Y%2==1)need = 1;
	if(P==-1)need ^= 1;

	long long x = (turns+1)/2;
	long long y = turns-x;
	
	if(turns%2==0){
		y--;
		if(X<=x&&get(Y-(turns-X))==P){
			cout<<"Alice"<<endl;
			return 0;
		}
		if(Y<=x&&get(0)==P){
			cout<<"Alice"<<endl;
			return 0;
		}
		cout<<"Bob"<<endl;
	}
	else{
		if(X<=y&&get(Y-(turns-X))!=P){
			cout<<"Bob"<<endl;
			return 0;
		}
		if(Y<=y&&get(0)!=P){
			cout<<"Bob"<<endl;
			return 0;
		}
		cout<<"Alice"<<endl;
	}
	
	return 0;
}
0