結果

問題 No.3 ビットすごろく
ユーザー ebicochinealebicochineal
提出日時 2017-01-24 17:46:11
言語 Python2
(2.7.18)
結果
AC  
実行時間 40 ms / 5,000 ms
コード長 170 bytes
コンパイル時間 53 ms
コンパイル使用メモリ 6,716 KB
実行使用メモリ 7,016 KB
最終ジャッジ日時 2023-09-14 00:19:10
合計ジャッジ時間 2,265 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,148 KB
testcase_01 AC 12 ms
6,208 KB
testcase_02 AC 11 ms
5,956 KB
testcase_03 AC 18 ms
6,164 KB
testcase_04 AC 13 ms
6,036 KB
testcase_05 AC 26 ms
6,296 KB
testcase_06 AC 18 ms
6,128 KB
testcase_07 AC 15 ms
6,052 KB
testcase_08 AC 23 ms
6,132 KB
testcase_09 AC 29 ms
6,104 KB
testcase_10 AC 34 ms
6,884 KB
testcase_11 AC 28 ms
6,212 KB
testcase_12 AC 25 ms
6,092 KB
testcase_13 AC 16 ms
6,164 KB
testcase_14 AC 33 ms
6,988 KB
testcase_15 AC 39 ms
6,996 KB
testcase_16 AC 36 ms
6,816 KB
testcase_17 AC 37 ms
7,016 KB
testcase_18 AC 15 ms
6,220 KB
testcase_19 AC 38 ms
6,860 KB
testcase_20 AC 12 ms
6,044 KB
testcase_21 AC 11 ms
5,964 KB
testcase_22 AC 34 ms
6,784 KB
testcase_23 AC 40 ms
6,808 KB
testcase_24 AC 38 ms
6,868 KB
testcase_25 AC 37 ms
6,892 KB
testcase_26 AC 12 ms
6,064 KB
testcase_27 AC 17 ms
6,136 KB
testcase_28 AC 35 ms
6,864 KB
testcase_29 AC 28 ms
6,204 KB
testcase_30 AC 12 ms
5,968 KB
testcase_31 AC 12 ms
6,052 KB
testcase_32 AC 26 ms
6,064 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');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