結果
問題 | No.240 ナイト散歩 |
ユーザー |
|
提出日時 | 2016-08-23 21:51:35 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 12 ms / 2,000 ms |
コード長 | 305 bytes |
コンパイル時間 | 296 ms |
コンパイル使用メモリ | 6,948 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-07 21:29:20 |
合計ジャッジ時間 | 1,243 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
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 > 2:continuefor 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"