結果

問題 No.2103 ±1s Game
ユーザー lam6er
提出日時 2025-03-31 17:53:13
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,189 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 81,912 KB
実行使用メモリ 54,228 KB
最終ジャッジ日時 2025-03-31 17:54:31
合計ジャッジ時間 3,010 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

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

if K == X + Y:
    y_rem = Y
    if (P == 1 and y_rem % 2 == 0) or (P == -1 and y_rem % 2 == 1):
        print("Alice")
    else:
        print("Bob")
else:
    T = X + Y - K
    required_P_parity = 0 if P == 1 else 1
    required_r_parity = (Y - required_P_parity) % 2

    min_r = max(0, T - X)
    max_r = min(T, Y)

    if min_r > max_r:
        print("Bob")
    else:
        # Determine possible parities in the range [min_r, max_r]
        min_parity = min_r % 2
        max_parity = max_r % 2
        possible_parities = []
        if min_parity == max_parity:
            possible_parities = [min_parity]
        else:
            possible_parities = [0, 1]

        # Check if required_r_parity is in possible_parities
        if required_r_parity not in possible_parities:
            print("Bob")
        else:
            # If all R in [min_r, max_r] have required_r_parity's parity
            if len(possible_parities) == 1:
                print("Alice")
            else:
                # Depends on T's parity
                if T % 2 == 1:
                    print("Alice")
                else:
                    print("Bob")
0