結果
| 問題 | No.240 ナイト散歩 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-07-23 02:49:21 |
| 言語 | Python3 (3.14.7 + numpy 2.5.2 + scipy 1.18.0) |
| 結果 |
AC
|
| 実行時間 | 91 ms / 2,000 ms |
| + 850µs | |
| コード長 | 553 bytes |
| 記録 | |
| コンパイル時間 | 303 ms |
| コンパイル使用メモリ | 21,540 KB |
| 実行使用メモリ | 15,992 KB |
| 最終ジャッジ日時 | 2026-08-16 02:41:37 |
| 合計ジャッジ時間 | 5,449 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
ソースコード
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()