結果

問題 No.240 ナイト散歩
ユーザー 👑 rin204
提出日時 2022-01-20 07:29:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 46 ms / 2,000 ms
コード長 313 bytes
コンパイル時間 259 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 52,480 KB
最終ジャッジ日時 2024-11-23 14:20:40
合計ジャッジ時間 2,785 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

di = [-1, 1, 2, 2, 1, -1, -2, -2]
dj = [2, 2, 1, -1, -2, -2, -1, 1]

x, y = map(int, input().split())

def dfs(i, j, c):
    if i == x and j == y:
        print("YES")
        exit()
    elif c == 3:
        return
    
    for k in range(8):
        dfs(i + di[k], j + dj[k], c + 1)
    
dfs(0, 0, 0)
print("NO")
0