結果

問題 No.3 ビットすごろく
ユーザー ebicochinealebicochineal
提出日時 2017-01-24 02:39:23
言語 Python2
(2.7.18)
結果
AC  
実行時間 32 ms / 5,000 ms
コード長 176 bytes
コンパイル時間 499 ms
コンパイル使用メモリ 6,696 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2023-09-14 00:19:07
合計ジャッジ時間 2,204 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,104 KB
testcase_01 AC 12 ms
5,980 KB
testcase_02 AC 12 ms
6,056 KB
testcase_03 AC 16 ms
6,172 KB
testcase_04 AC 14 ms
6,028 KB
testcase_05 AC 22 ms
6,096 KB
testcase_06 AC 17 ms
6,128 KB
testcase_07 AC 14 ms
6,040 KB
testcase_08 AC 19 ms
6,136 KB
testcase_09 AC 23 ms
6,096 KB
testcase_10 AC 27 ms
6,884 KB
testcase_11 AC 22 ms
6,092 KB
testcase_12 AC 21 ms
6,160 KB
testcase_13 AC 16 ms
6,164 KB
testcase_14 AC 28 ms
6,880 KB
testcase_15 AC 32 ms
6,948 KB
testcase_16 AC 28 ms
6,900 KB
testcase_17 AC 30 ms
6,928 KB
testcase_18 AC 15 ms
6,128 KB
testcase_19 AC 30 ms
6,900 KB
testcase_20 AC 13 ms
6,212 KB
testcase_21 AC 11 ms
6,148 KB
testcase_22 AC 28 ms
6,892 KB
testcase_23 AC 31 ms
6,820 KB
testcase_24 AC 30 ms
6,804 KB
testcase_25 AC 31 ms
6,900 KB
testcase_26 AC 12 ms
6,216 KB
testcase_27 AC 16 ms
6,048 KB
testcase_28 AC 28 ms
6,888 KB
testcase_29 AC 23 ms
6,176 KB
testcase_30 AC 12 ms
6,168 KB
testcase_31 AC 12 ms
5,996 KB
testcase_32 AC 22 ms
6,252 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=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')
  if i==N-1:a=c
  if(i in r)<1:r[i],l=1,l+[i+b]*(i+b<N)+[i-b]*(i>b)
print[-1,a][a<N]
0