結果

問題 No.3 ビットすごろく
コンテスト
ユーザー jamad
提出日時 2017-08-13 05:25:49
言語 Python3
(3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
RE  
実行時間 -
コード長 241 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 56 ms
コンパイル使用メモリ 15,104 KB
実行使用メモリ 66,560 KB
最終ジャッジ日時 2026-09-15 12:17:14
合計ジャッジ時間 4,479 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23 RE * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def upd(x,t):
 if 0<x<=N and A[x]==[]:Q.append(x);A[x]=A[t]+[x]
    
def bfs():
 while Q:
  t=Q.pop(0)
  if t==N:return A[N]
  c=bin(t).count('1');upd(t+c,t);upd(t-c,t)
 return -1

N=int(input())
A=[[]]*10001
A[1]=[1]
Q=[1]
print(len(bfs()))
0