結果
問題 |
No.240 ナイト散歩
|
ユーザー |
|
提出日時 | 2023-08-25 11:24:07 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 44 ms / 2,000 ms |
コード長 | 357 bytes |
コンパイル時間 | 180 ms |
コンパイル使用メモリ | 81,664 KB |
実行使用メモリ | 52,224 KB |
最終ジャッジ日時 | 2024-12-23 18:13:48 |
合計ジャッジ時間 | 2,629 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
X, Y = map(int, input().split()) way = [(2, 1), (2, -1), (-2, 1), (-2, -1), \ (1, 2), (-1, 2), (1, -2), (-1, -2)] s = set((0, 0)) def dfs(x, y, c): if c >= 3: return for nx, ny in way: nx += x ny += y s.add((nx, ny)) dfs(nx, ny, c+1) dfs(0, 0, 0) if (X, Y) in s: print('YES') else: print('NO')