結果
| 問題 |
No.3108 Luke or Bishop
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-18 21:24:34 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 702 bytes |
| コンパイル時間 | 279 ms |
| コンパイル使用メモリ | 12,288 KB |
| 実行使用メモリ | 10,368 KB |
| 最終ジャッジ日時 | 2025-04-18 21:24:39 |
| 合計ジャッジ時間 | 1,709 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 25 WA * 1 |
ソースコード
def solve_chess_puzzle(gx: int, gy: int) -> int:
# For rook (Luke): We need to move horizontally and vertically
# Minimum moves for rook is 1 if on same row/column, otherwise 2
rook_moves = 1 if gx == 0 or gy == 0 else 2
# For bishop: We can move diagonally
# If target is on diagonal (|x| = |y|), we need 1 move
# Otherwise, we need 2 moves to reach any point
bishop_moves = 1 if abs(gx) == abs(gy) else 2
# Return the minimum of both possibilities
return min(rook_moves, bishop_moves)
def main():
# Read input
gx, gy = map(int, input().split())
# Print result
print(solve_chess_puzzle(gx, gy))
if __name__ == "__main__":
main()