結果

問題 No.2103 ±1s Game
ユーザー maspy
提出日時 2022-10-21 23:07:00
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 32 ms / 1,000 ms
コード長 1,114 bytes
コンパイル時間 227 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-07-01 07:26:43
合計ジャッジ時間 2,549 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

def F(P, X, Y, K):
    # このままだと、食べる量が P になるようになっている
    # 「残りの積」になおす
    if Y % 2 == 1:
        P = -P
    if P == 1 and X % 2 == 0 and X < Y:
        if K <= Y - X:
            return (Y + K + 1) % 2
        return (Y + K) % 2
    if P == 1 and X % 2 == 0 and X >= Y:
        if K <= X - Y:
            return (Y + 1) % 2
        return (Y + K) % 2
    if P == 1 and X % 2 == 1 and X <= Y:
        return (K + Y + 1) % 2
    if P == 1 and X % 2 == 1 and X > Y:
        if K <= X - Y:
            return (Y + 1) % 2
        return (K + Y + 1) % 2
    assert P == -1
    if X % 2 == 0 and X <= Y:
        return (Y + K) % 2
    if X % 2 == 0 and X > Y:
        if K <= X - Y:
            return Y % 2
        return (Y + K) % 2
    if X % 2 == 1 and X < Y:
        if K <= Y - X:
            return (Y + K) % 2
        return (Y + K + 1) % 2
    if X % 2 == 1 and X >= Y:
        if K <= X - Y:
            return Y % 2
        return (Y + K + 1) % 2
    return -1


X, Y, K, P = map(int, input().split())
print("Alice" if F(P, X, Y, K) else "Bob")
0