結果
問題 |
No.240 ナイト散歩
|
ユーザー |
![]() |
提出日時 | 2020-12-30 21:29:26 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 447 bytes |
コンパイル時間 | 474 ms |
コンパイル使用メモリ | 81,916 KB |
実行使用メモリ | 55,720 KB |
最終ジャッジ日時 | 2024-10-08 03:05:28 |
合計ジャッジ時間 | 3,139 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 25 WA * 5 |
ソースコード
x,y = map(int,input().split()) move = [] for i in [-1,1]: for j in [-2,2]: move += [(i,j),(j,i)] d = {(0,0):0} from collections import deque q = deque() q.append((0,0)) while q: a,b = q.popleft() x = d[a,b] if x >= 3: continue for i,j in move: na, nb = a+i, b+j if (na,nb) not in d: d[na,nb] = x+1 if x <= 2: q.append((na,nb)) print("YES" if (x,y) in d else "NO")