結果

問題 No.240 ナイト散歩
コンテスト
ユーザー 1235486527
提出日時 2020-01-10 11:30:35
言語 Python3
(3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 18 ms / 2,000 ms
+ 728µs
コード長 405 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 685 ms
コンパイル使用メモリ 14,464 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2026-10-28 17:27:18
合計ジャッジ時間 2,810 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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