結果
問題 |
No.3108 Luke or Bishop
|
ユーザー |
|
提出日時 | 2025-04-19 11:46:39 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 29 ms / 2,000 ms |
コード長 | 469 bytes |
コンパイル時間 | 792 ms |
コンパイル使用メモリ | 12,032 KB |
実行使用メモリ | 10,240 KB |
最終ジャッジ日時 | 2025-04-19 11:46:41 |
合計ジャッジ時間 | 2,196 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 26 |
ソースコード
gx, gy = map(int, input().split()) def rook_moves(x, y): if x == 0 and y == 0: return 0 elif x == 0 or y == 0: return 1 else: return 2 def bishop_moves(x, y): if (x + y) % 2 != 0: return float('inf') # tidak bisa dicapai if x == 0 and y == 0: return 0 elif abs(x) == abs(y): return 1 else: return 2 rook = rook_moves(gx, gy) bishop = bishop_moves(gx, gy) print(min(rook, bishop))