結果
問題 |
No.240 ナイト散歩
|
ユーザー |
|
提出日時 | 2024-05-23 09:53:22 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 50 ms / 2,000 ms |
コード長 | 400 bytes |
コンパイル時間 | 378 ms |
コンパイル使用メモリ | 82,504 KB |
実行使用メモリ | 62,752 KB |
最終ジャッジ日時 | 2024-12-20 18:46:51 |
合計ジャッジ時間 | 3,234 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
def dfs(x, y, c): if c > 3: return if x == X and y == Y: print("YES") exit() dfs(x - 2, y - 1, c + 1) dfs(x - 2, y + 1, c + 1) dfs(x - 1, y - 2, c + 1) dfs(x - 1, y + 2, c + 1) dfs(x + 1, y - 2, c + 1) dfs(x + 1, y + 2, c + 1) dfs(x + 2, y - 1, c + 1) dfs(x + 2, y + 1, c + 1) X, Y = map(int, input().split()) dfs(0, 0, 0) print("NO")