結果
| 問題 | No.3 ビットすごろく |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-11-28 07:20:24 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 49 ms / 5,000 ms |
| + 594µs | |
| コード長 | 543 bytes |
| 記録 | |
| コンパイル時間 | 72 ms |
| コンパイル使用メモリ | 80,512 KB |
| 実行使用メモリ | 74,880 KB |
| 最終ジャッジ日時 | 2026-09-10 11:25:52 |
| 合計ジャッジ時間 | 3,285 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 33 |
ソースコード
# import pypyjit
# pypyjit.set_param('max_unroll_recursion=-1')
from collections import *
from functools import *
from itertools import *
from heapq import *
import sys,math
input = sys.stdin.readline
N = int(input())
dist = defaultdict(lambda: -1)
v = deque()
dist[1]=1
v.append(1)
while v:
x = v.popleft()
delta = bin(x).count('1')
e = [x-delta,x+delta]
for ix in e:
if dist[ix]!=-1:
continue
if ix>N:
continue
dist[ix]=dist[x]+1
v.append(ix)
print(dist[N])