結果

問題 No.3 ビットすごろく
ユーザー ebicochineal
提出日時 2017-02-07 20:28:47
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 65 ms / 5,000 ms
コード長 177 bytes
コンパイル時間 80 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 11,520 KB
最終ジャッジ日時 2024-07-01 08:16:52
合計ジャッジ時間 2,536 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())+1;a,l,c,r=N,[1],0,{}
while c<a:
 q=l;l=[];c+=1
 for i in q:b=bin(i).count('1');a=[a,c][i==N-1];l=[l+[i+b]*(i+b<N)+[i-b]*(i>b),l][i in r];r[i]=1
print([-1,a][a<N])
0