結果

問題 No.240 ナイト散歩
ユーザー niyarinniyarin
提出日時 2016-08-23 21:47:01
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 305 bytes
コンパイル時間 116 ms
コンパイル使用メモリ 6,944 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-25 13:41:34
合計ジャッジ時間 1,679 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
6,820 KB
testcase_01 AC 18 ms
6,940 KB
testcase_02 AC 18 ms
6,948 KB
testcase_03 AC 19 ms
6,944 KB
testcase_04 AC 20 ms
6,944 KB
testcase_05 AC 18 ms
6,940 KB
testcase_06 AC 18 ms
6,944 KB
testcase_07 AC 17 ms
6,944 KB
testcase_08 AC 17 ms
6,944 KB
testcase_09 AC 18 ms
6,944 KB
testcase_10 AC 18 ms
6,944 KB
testcase_11 AC 17 ms
6,940 KB
testcase_12 AC 18 ms
6,940 KB
testcase_13 AC 18 ms
6,944 KB
testcase_14 AC 18 ms
6,944 KB
testcase_15 AC 18 ms
6,944 KB
testcase_16 AC 18 ms
6,940 KB
testcase_17 AC 18 ms
6,940 KB
testcase_18 AC 18 ms
6,940 KB
testcase_19 AC 19 ms
6,940 KB
testcase_20 AC 18 ms
6,940 KB
testcase_21 AC 19 ms
6,940 KB
testcase_22 AC 18 ms
6,940 KB
testcase_23 AC 17 ms
6,940 KB
testcase_24 AC 17 ms
6,940 KB
testcase_25 AC 18 ms
6,944 KB
testcase_26 AC 17 ms
6,940 KB
testcase_27 AC 18 ms
6,944 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 18 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

dx = [-2,-2,-1,-1,1,1,2,2]
dy = [-1,1,-2,2,-2,2,-1,1]


nyrn = set()
q = [(0,0,0)]
while q:
    x,y,c = q.pop(0)
    nyrn.add((x,y))
    if c > 3:
        continue
    for i in range(8):
        q.append((x+dx[i],y+dy[i],c+1))

X,Y = map(int,raw_input().split(" "))
print "YES" if (X,Y) in nyrn else "NO"
0