結果

問題 No.240 ナイト散歩
ユーザー yomo3
提出日時 2020-03-01 20:31:41
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 340 bytes
コンパイル時間 212 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-10-13 20:50:24
合計ジャッジ時間 2,288 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import product

X, Y = map(int, input().split())

d = [[-2,-1],[-2,1],[-1,-2],[-1,2],[1,-2],[1,2],[2,-1],[2,1]]
yes = False
for steps in product(d, repeat=3):
    x = y = 0
    for s in steps:
        x += s[0]
        y += s[1]
        if x==X and y==Y:
            yes = True
            break
print('YES' if yes else 'NO')
0