結果

問題 No.2476 Knight Game
ユーザー 👑 rin204rin204
提出日時 2023-09-08 18:53:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 645 ms / 2,000 ms
コード長 729 bytes
コンパイル時間 1,104 ms
コンパイル使用メモリ 86,872 KB
実行使用メモリ 79,280 KB
最終ジャッジ日時 2023-09-15 22:30:11
合計ジャッジ時間 5,448 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
70,788 KB
testcase_01 AC 645 ms
78,804 KB
testcase_02 AC 588 ms
79,280 KB
testcase_03 AC 597 ms
78,760 KB
testcase_04 AC 596 ms
78,788 KB
testcase_05 AC 594 ms
78,492 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(h, w, x, y):
    if h > w:
        h, w = w, h
        x, y = y, x
    if h == 1:
        return False
    elif h == 2:
        c1 = (y + 1) // 2
        c2 = (w - y + 2) // 2
        return c1 % 2 == 0 or c2 % 2 == 0
    elif h * w % 2 == 0:
        return True
    elif (x + y) % 2 == 1:
        return True
    elif (h, w) == (3, 3):
        return (x, y) != (2, 2)
    elif (h, w) == (3, 5):
        return (x, y) in [(1, 3), (3, 3)]
    else:
        return False


T = int(input())
assert 1 <= T <= 200000
for _ in range(T):
    H, W, x, y = map(int, input().split())
    assert 1 <= x <= H <= 10**9
    assert 1 <= y <= W <= 10**9

    if solve(H, W, x, y):
        print("Alice")
    else:
        print("Bob")
0