結果

問題 No.240 ナイト散歩
ユーザー 12354865271235486527
提出日時 2020-01-10 11:30:35
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 405 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-11-23 21:46:08
合計ジャッジ時間 2,213 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

from copy import deepcopy
X, Y = map(int, input().split())
dx, dy= (1, 2), (2, 1)
sn = tuple((1*i, 1*j) for i in (-1, 1) for j in (-1, 1))
S = {(0, 0)}
for _ in range(3):
    for cx, cy in deepcopy(S):
        for tx, ty in zip(dx, dy):
            for sx, sy in sn:
                px = cx + tx * sx
                py = cy + ty * sy
                S.add((px, py))
print('YES' if (X, Y) in S else 'NO')
0