結果

問題 No.240 ナイト散歩
ユーザー けむけむ
提出日時 2021-07-23 02:46:01
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 552 bytes
コンパイル時間 122 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-07-18 00:04:32
合計ジャッジ時間 2,148 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 25 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

def naito(N, loc):
    if N < 0:
        return
    init_loc = loc
    moves = [[-2, -1], [-2, 1], [-1, -2], [-1, 2], [1, -2], [1, 2], [2, -1], [2, 1]]
    for move in moves:
        loc = [] + init_loc
        loc[0] = loc[0] + move[0]
        loc[1] = loc[1] + move[1]
        if loc == [0, 0]:
            return 'YES'
        next = naito(N - 1, loc)
        if next == 'YES':
            return 'YES'
    return 'NO'

def main():
    X, Y = map(int, input().split())
    loc = [X, Y]
    print(naito(3, loc))

if __name__ == '__main__':
    main()
0