結果
問題 |
No.240 ナイト散歩
|
ユーザー |
|
提出日時 | 2016-08-23 21:47:01 |
言語 | Python2 (2.7.18) |
結果 |
WA
|
実行時間 | - |
コード長 | 305 bytes |
コンパイル時間 | 311 ms |
コンパイル使用メモリ | 6,912 KB |
実行使用メモリ | 6,656 KB |
最終ジャッジ日時 | 2024-11-08 00:40:22 |
合計ジャッジ時間 | 1,625 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 25 WA * 5 |
ソースコード
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"