結果
問題 | No.3 ビットすごろく |
ユーザー |
|
提出日時 | 2020-06-10 19:38:51 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 900 bytes |
コンパイル時間 | 128 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 17,572 KB |
最終ジャッジ日時 | 2024-06-23 13:59:27 |
合計ジャッジ時間 | 6,812 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 4 WA * 1 TLE * 1 -- * 27 |
ソースコード
inp = int(input())def bitJusawi(goal):move = lambda x: list(map(int, list(bin(x)[2:]))).count(1)his = [] ; loc = 0; ops = 0; rem = goal - locwhile goal != loc:his.append(loc)if len(his) >= 11:his.pop(0)rem = goal - locif ops == 0:ops = 1; loc = 1else:ops += 1rng = move(loc)if rem >= rng:loc += rngelse:bounce = goal - ((loc + rng) - goal)if loc - rng < bounce and loc != bounce:loc = bounceelse:loc -= rngcond = []for i in range(2,11,2):if ops >= i:h = i // 2cond.append(loc == his[-h] == his[-i])if any(cond):return -1return opsprint(bitJusawi(inp))