結果

問題 No.3108 Luke or Bishop
ユーザー ts yi
提出日時 2025-04-19 09:48:52
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 466 bytes
コンパイル時間 133 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2025-04-19 09:48:54
合計ジャッジ時間 1,956 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

def min_moves(Gx, Gy):
    if Gx == 0 and Gy == 0:
        rook_steps = 0
    elif Gx == 0 or Gy == 0:
        rook_steps = 1
    else:
        rook_steps = 2

    if (Gx + Gy) % 2 != 0:
        bishop_steps = float('inf')
    elif Gx == 0 and Gy == 0:
        bishop_steps = 0
    elif abs(Gx) == abs(Gy):
        bishop_steps = 1
    else:
        bishop_steps = 2

    return min(rook_steps, bishop_steps)
    
Gx, Gy = map(int, input().split())
min_moves(Gx, Gy)
0