結果

問題 No.240 ナイト散歩
ユーザー ronpooronpoo
提出日時 2023-08-25 11:24:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 357 bytes
コンパイル時間 329 ms
コンパイル使用メモリ 87,312 KB
実行使用メモリ 71,632 KB
最終ジャッジ日時 2023-08-25 11:24:13
合計ジャッジ時間 5,266 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,444 KB
testcase_01 AC 70 ms
71,236 KB
testcase_02 AC 69 ms
71,384 KB
testcase_03 AC 73 ms
71,228 KB
testcase_04 AC 69 ms
71,424 KB
testcase_05 AC 70 ms
71,480 KB
testcase_06 AC 68 ms
71,628 KB
testcase_07 AC 68 ms
71,232 KB
testcase_08 AC 68 ms
71,304 KB
testcase_09 AC 68 ms
71,548 KB
testcase_10 AC 68 ms
71,472 KB
testcase_11 AC 68 ms
71,456 KB
testcase_12 AC 69 ms
71,408 KB
testcase_13 AC 68 ms
71,312 KB
testcase_14 AC 71 ms
71,228 KB
testcase_15 AC 70 ms
71,248 KB
testcase_16 AC 68 ms
71,392 KB
testcase_17 AC 68 ms
71,468 KB
testcase_18 AC 67 ms
71,228 KB
testcase_19 AC 68 ms
71,348 KB
testcase_20 AC 69 ms
71,228 KB
testcase_21 AC 66 ms
71,552 KB
testcase_22 AC 69 ms
71,444 KB
testcase_23 AC 69 ms
71,460 KB
testcase_24 AC 67 ms
71,452 KB
testcase_25 AC 68 ms
71,588 KB
testcase_26 AC 68 ms
71,488 KB
testcase_27 AC 71 ms
71,428 KB
testcase_28 AC 70 ms
71,348 KB
testcase_29 AC 68 ms
71,464 KB
testcase_30 AC 69 ms
71,308 KB
testcase_31 AC 68 ms
71,404 KB
testcase_32 AC 69 ms
71,452 KB
testcase_33 AC 68 ms
71,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

way = [(2, 1), (2, -1), (-2, 1), (-2, -1), \
    (1, 2), (-1, 2), (1, -2), (-1, -2)]

s = set((0, 0))
def dfs(x, y, c):
    if c >= 3:
        return
    for nx, ny in way:
        nx += x
        ny += y
        s.add((nx, ny))
        dfs(nx, ny, c+1)

dfs(0, 0, 0)
if (X, Y) in s:
    print('YES')
else:
    print('NO')
0