結果

問題 No.240 ナイト散歩
ユーザー flippergoflippergo
提出日時 2020-12-28 16:37:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 47 ms / 2,000 ms
コード長 442 bytes
コンパイル時間 240 ms
コンパイル使用メモリ 82,356 KB
実行使用メモリ 55,668 KB
最終ジャッジ日時 2024-04-14 09:56:35
合計ジャッジ時間 2,933 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
54,664 KB
testcase_01 AC 43 ms
54,752 KB
testcase_02 AC 45 ms
55,172 KB
testcase_03 AC 41 ms
54,272 KB
testcase_04 AC 45 ms
54,532 KB
testcase_05 AC 42 ms
55,548 KB
testcase_06 AC 42 ms
55,000 KB
testcase_07 AC 42 ms
54,336 KB
testcase_08 AC 42 ms
55,668 KB
testcase_09 AC 42 ms
55,604 KB
testcase_10 AC 41 ms
55,012 KB
testcase_11 AC 41 ms
54,652 KB
testcase_12 AC 42 ms
54,060 KB
testcase_13 AC 42 ms
53,880 KB
testcase_14 AC 42 ms
54,128 KB
testcase_15 AC 42 ms
54,788 KB
testcase_16 AC 42 ms
55,596 KB
testcase_17 AC 42 ms
54,092 KB
testcase_18 AC 42 ms
54,848 KB
testcase_19 AC 42 ms
54,672 KB
testcase_20 AC 42 ms
55,348 KB
testcase_21 AC 42 ms
54,840 KB
testcase_22 AC 42 ms
54,544 KB
testcase_23 AC 42 ms
54,156 KB
testcase_24 AC 42 ms
55,136 KB
testcase_25 AC 43 ms
54,660 KB
testcase_26 AC 42 ms
54,520 KB
testcase_27 AC 42 ms
55,664 KB
testcase_28 AC 43 ms
55,200 KB
testcase_29 AC 42 ms
54,312 KB
testcase_30 AC 41 ms
53,988 KB
testcase_31 AC 43 ms
55,236 KB
testcase_32 AC 43 ms
55,240 KB
testcase_33 AC 43 ms
54,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
def step(x,y):
    A = [(x-2,y+1),(x-2,y-1),(x-1,y+2),(x-1,y-2),(x+1,y+2),(x+1,y-2),
    (x+2,y+1),(x+2,y-1)]
    return A
A = deque([(0,0,0)])
B = [(0,0)]
while A:
    x,y,cnt = A.popleft()
    if cnt<3:
        C = step(x,y)
        cnt += 1
        B += C
        for x1,y1 in C:
            A.append((x1,y1,cnt))
B = set(B)
X,Y = map(int,input().split())
if (X,Y) in B:
    print("YES")
else:
    print("NO")
0