結果
| 問題 | 
                            No.240 ナイト散歩
                             | 
                    
| コンテスト | |
| ユーザー | 
                             akanaya
                         | 
                    
| 提出日時 | 2020-04-01 21:07:51 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 32 ms / 2,000 ms | 
| コード長 | 665 bytes | 
| コンパイル時間 | 88 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 10,752 KB | 
| 最終ジャッジ日時 | 2024-06-27 06:58:35 | 
| 合計ジャッジ時間 | 2,062 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 30 | 
ソースコード
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)    
            
            
            
        
            
akanaya