結果
問題 | No.240 ナイト散歩 |
ユーザー |
|
提出日時 | 2023-03-28 19:20:15 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 42 ms / 2,000 ms |
コード長 | 469 bytes |
コンパイル時間 | 144 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 52,480 KB |
最終ジャッジ日時 | 2024-09-20 08:11:32 |
合計ジャッジ時間 | 2,364 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
Directions = [(-2, -1), (-2, 1), (-1, -2), (-1, 2), (1, -2), (1, 2), (2, -1), (2, 1)]P = [(0, 0)]seen = set([(0, 0)])for _ in range(3):NP = []for cx, cy in P:for dx, dy in Directions:nx, ny = cx + dx, cy + dyif (nx, ny) in seen:continueseen.add((nx, ny))NP.append((nx, ny))P = NPx, y = map(int, input().split())if (x, y) in seen:print("YES")else:print("NO")