結果
問題 | No.240 ナイト散歩 |
ユーザー |
![]() |
提出日時 | 2020-12-30 21:34:00 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 48 ms / 2,000 ms |
コード長 | 427 bytes |
コンパイル時間 | 280 ms |
コンパイル使用メモリ | 81,472 KB |
実行使用メモリ | 54,144 KB |
最終ジャッジ日時 | 2024-10-08 03:13:48 |
合計ジャッジ時間 | 2,742 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
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 dequeq = deque()q.append((0,0))while q:a,b = q.popleft()p = d[a,b]for i,j in move:na, nb = a+i, b+jif (na,nb) not in d:if p <= 2:d[na,nb] = p+1q.append((na,nb))print("YES" if (x,y) in d else "NO")