結果

問題 No.240 ナイト散歩
ユーザー akanayaakanaya
提出日時 2020-04-01 21:05:01
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 665 bytes
コンパイル時間 123 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-06-27 06:53:33
合計ジャッジ時間 2,192 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 3
other AC * 19 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

xy = list(map(int, input().split(' ')))

df = [
    [1, 2],
    [-1, 2],
    [1, -2],
    [-1, -2],
    [2, 1],
    [-2, 1],
    [2, -1],
    [-2, -1]
]

def check(pos, cand, n):
    if n == 0:
        return 'NO'
    else:
        result = []
        for c in cand:
            for d in df:
                temp = [
                    c[0] + d[0],
                    c[1] + d[1]
                ]
                if temp[0] == pos[0] and temp[1] == pos[1]:
                    return 'Yes'
                else:
                    result.append(temp)
        return check(pos, result, n - 1)

current = [[0, 0]]
result = check(xy, current, 3)
print(result)    
0