結果
| 問題 |
No.3108 Luke or Bishop
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-19 12:50:39 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 448 bytes |
| コンパイル時間 | 454 ms |
| コンパイル使用メモリ | 12,032 KB |
| 実行使用メモリ | 10,496 KB |
| 最終ジャッジ日時 | 2025-04-19 12:50:41 |
| 合計ジャッジ時間 | 2,447 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 25 WA * 1 |
ソースコード
def min_moves_to_goal(gx: int, gy: int) -> int:
# Rook hand count
rook_moves = 1 if gx == 0 or gy == 0 else 2
# Bishop: same color check
if (gx + gy) % 2 != 0:
bishop_moves = float('inf') # bishop cannot reach
elif gx == gy or gx == -gy:
bishop_moves = 1
else:
bishop_moves = 2
return min(rook_moves, bishop_moves)
# 入力
gx, gy = map(int, input().split())
print(min_moves_to_goal(gx, gy))