結果
| 問題 |
No.240 ナイト散歩
|
| ユーザー |
matsu7874
|
| 提出日時 | 2015-08-29 01:43:31 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 51 ms / 2,000 ms |
| コード長 | 412 bytes |
| コンパイル時間 | 277 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 11,392 KB |
| 最終ジャッジ日時 | 2024-10-07 21:08:08 |
| 合計ジャッジ時間 | 2,557 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
ソースコード
import queue
X, Y = map(int, input().split())
Q = queue.Queue()
Q.put((0, 0, 0))
D = [(-2, -1), (-2, 1), (-1, -2), (-1, 2), (1, -2), (1, 2), (2, -1), (2, 1)]
while not Q.empty():
q = Q.get()
# print(q)
if q[0] > 3:
continue
elif q[1] == X and q[2] == Y:
print('YES')
exit()
else:
for d in D:
Q.put((q[0] + 1, q[1] + d[0], q[2] + d[1]))
print('NO')
matsu7874