結果

問題 No.240 ナイト散歩
コンテスト
ユーザー tnoda_
提出日時 2015-08-26 14:24:28
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 95 ms / 2,000 ms
コード長 390 bytes
コンパイル時間 203 ms
コンパイル使用メモリ 77,824 KB
最終ジャッジ日時 2025-12-03 16:25:19
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def moves(x, y):
    dx = (-2, -2, -1, -1, +1, +1, +2, +2)
    dy = (-1, +1, -2, +2, -2, +2, -1, +1)
    return [(x+dx[i], y+dy[i]) for i in range(8)]

X, Y = map(int, raw_input().split())
pos = set([(X, Y)])
for i in range(3):
    s = set(pos)
    for (x0, y0) in s:
        for (x, y) in moves(x0, y0):
            pos.add((x, y))
if (0, 0) in pos:
    print('YES')
else:
    print('NO')
0