結果

問題 No.3 ビットすごろく
ユーザー ebicochinealebicochineal
提出日時 2017-01-24 02:11:00
言語 Python2
(2.7.18)
結果
AC  
実行時間 24 ms / 5,000 ms
コード長 180 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 6,676 KB
実行使用メモリ 6,936 KB
最終ジャッジ日時 2023-09-14 00:19:02
合計ジャッジ時間 1,807 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
5,976 KB
testcase_01 AC 10 ms
5,980 KB
testcase_02 AC 11 ms
6,184 KB
testcase_03 AC 14 ms
6,264 KB
testcase_04 AC 11 ms
6,028 KB
testcase_05 AC 18 ms
6,196 KB
testcase_06 AC 14 ms
6,116 KB
testcase_07 AC 13 ms
6,124 KB
testcase_08 AC 15 ms
6,044 KB
testcase_09 AC 19 ms
6,144 KB
testcase_10 AC 20 ms
6,792 KB
testcase_11 AC 17 ms
6,076 KB
testcase_12 AC 17 ms
6,140 KB
testcase_13 AC 12 ms
6,064 KB
testcase_14 AC 21 ms
6,760 KB
testcase_15 AC 24 ms
6,900 KB
testcase_16 AC 21 ms
6,832 KB
testcase_17 AC 22 ms
6,764 KB
testcase_18 AC 12 ms
6,112 KB
testcase_19 AC 23 ms
6,792 KB
testcase_20 AC 10 ms
6,164 KB
testcase_21 AC 10 ms
6,092 KB
testcase_22 AC 20 ms
6,936 KB
testcase_23 AC 24 ms
6,764 KB
testcase_24 AC 22 ms
6,804 KB
testcase_25 AC 22 ms
6,880 KB
testcase_26 AC 10 ms
6,008 KB
testcase_27 AC 13 ms
6,128 KB
testcase_28 AC 21 ms
6,856 KB
testcase_29 AC 17 ms
6,296 KB
testcase_30 AC 11 ms
6,200 KB
testcase_31 AC 10 ms
5,984 KB
testcase_32 AC 17 ms
6,328 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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