結果
| 問題 |
No.240 ナイト散歩
|
| コンテスト | |
| ユーザー |
学ぶマン
|
| 提出日時 | 2025-06-13 21:17:27 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 40 ms / 2,000 ms |
| コード長 | 643 bytes |
| コンパイル時間 | 4,131 ms |
| コンパイル使用メモリ | 82,652 KB |
| 実行使用メモリ | 53,844 KB |
| 最終ジャッジ日時 | 2025-06-13 21:17:35 |
| 合計ジャッジ時間 | 3,318 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
ソースコード
from itertools import product
X, Y = map(int, input().split())
steps = [(-2, -1), (-2, 1), (-1, -2), (-1, 2),(2, -1), (2, 1), (1, -2), (1, 2)]
# 3歩
x, y = 0, 0
memo0 = [(0, 0)]
memo1 = []
for x, y in memo0:
for ii, jj in steps:
x1, y1 = x + ii, y + jj
memo1.append((x1, y1))
memo2 = []
for x, y in memo1:
for ii, jj in steps:
x1, y1 = x + ii, y + jj
memo2.append((x1, y1))
memo3 = []
for x, y in memo2:
for ii, jj in steps:
x1, y1 = x + ii, y + jj
memo3.append((x1, y1))
memo_all = memo0 + memo1 + memo2 + memo3
if (X, Y) in memo_all:
print('YES')
else:
print('NO')
学ぶマン