結果

問題 No.2103 ±1s Game
ユーザー lam6er
提出日時 2025-04-15 22:19:08
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 895 bytes
コンパイル時間 383 ms
コンパイル使用メモリ 81,740 KB
実行使用メモリ 53,920 KB
最終ジャッジ日時 2025-04-15 22:20:33
合計ジャッジ時間 2,530 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

X, Y, K, P = map(int, input().split())

R = 0 if P == 1 else 1
target_parity = (Y - R) % 2
T = X + Y - K

b_min = max(0, T - X)
b_max = min(Y, T)

# Check if there exists a b in [b_min, b_max] with parity target_parity
possible = False
if b_min <= b_max:
    # Find the first candidate >= b_min with target_parity
    if (b_min % 2) == target_parity:
        possible = True
    else:
        candidate = b_min + 1
        if candidate <= b_max:
            possible = True

if not possible:
    print("Bob")
else:
    s = min(X, Y)
    if T <= s:
        if T % 2 == 1:
            print("Alice")
        else:
            print("Bob")
    else:
        if Y >= X:
            total_parity = (s % 2) + (T - s) % 2
        else:
            total_parity = s % 2
        total_parity %= 2
        if total_parity == target_parity:
            print("Alice")
        else:
            print("Bob")
0