結果
問題 |
No.240 ナイト散歩
|
ユーザー |
![]() |
提出日時 | 2020-12-30 21:31:52 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 427 bytes |
コンパイル時間 | 324 ms |
コンパイル使用メモリ | 81,968 KB |
実行使用メモリ | 55,856 KB |
最終ジャッジ日時 | 2024-10-08 03:09:10 |
合計ジャッジ時間 | 3,071 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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] for i,j in move: na, nb = a+i, b+j if (na,nb) not in d: if x <= 2: d[na,nb] = x+1 q.append((na,nb)) print("YES" if (x,y) in d else "NO")