結果
| 問題 |
No.3 ビットすごろく
|
| コンテスト | |
| ユーザー |
kanoekakihito
|
| 提出日時 | 2016-09-23 22:10:37 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 403 bytes |
| コンパイル時間 | 93 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 336,580 KB |
| 最終ジャッジ日時 | 2024-11-17 20:00:51 |
| 合計ジャッジ時間 | 164,038 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 1 WA * 5 TLE * 27 |
ソースコード
n = int(input())
prev = [[1, []]]
end_flag = False
c = 1
while len(prev) != 0:
next = []
for p in prev:
if p[0] == n:
end_flag = True
break
b = bin(p[0])[2:].count("1")
for i in range(2):
next_place = p[0] + b * (-1) ** i
if 1 <= next_place <= n and not next_place in p[1]:
next.append([next_place, p[1] + [p[0]]])
if end_flag:
break
c += 1
prev = next
else:
print(-1)
kanoekakihito