結果

問題 No.3 ビットすごろく
ユーザー ebicochinealebicochineal
提出日時 2017-02-08 12:13:42
言語 Python2
(2.7.18)
結果
AC  
実行時間 37 ms / 5,000 ms
コード長 168 bytes
コンパイル時間 52 ms
コンパイル使用メモリ 6,508 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2023-09-14 00:19:41
合計ジャッジ時間 1,921 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
6,060 KB
testcase_01 AC 10 ms
6,092 KB
testcase_02 AC 10 ms
6,032 KB
testcase_03 AC 19 ms
6,136 KB
testcase_04 AC 13 ms
6,028 KB
testcase_05 AC 25 ms
6,272 KB
testcase_06 AC 18 ms
6,004 KB
testcase_07 AC 13 ms
6,072 KB
testcase_08 AC 20 ms
6,124 KB
testcase_09 AC 26 ms
6,056 KB
testcase_10 AC 30 ms
6,900 KB
testcase_11 AC 24 ms
6,344 KB
testcase_12 AC 23 ms
6,052 KB
testcase_13 AC 15 ms
6,156 KB
testcase_14 AC 30 ms
6,832 KB
testcase_15 AC 36 ms
6,944 KB
testcase_16 AC 31 ms
6,888 KB
testcase_17 AC 32 ms
6,884 KB
testcase_18 AC 14 ms
6,168 KB
testcase_19 AC 33 ms
6,944 KB
testcase_20 AC 12 ms
5,992 KB
testcase_21 AC 10 ms
6,080 KB
testcase_22 AC 30 ms
6,900 KB
testcase_23 AC 37 ms
6,796 KB
testcase_24 AC 34 ms
6,924 KB
testcase_25 AC 33 ms
6,800 KB
testcase_26 AC 11 ms
6,008 KB
testcase_27 AC 15 ms
6,036 KB
testcase_28 AC 32 ms
6,920 KB
testcase_29 AC 25 ms
6,080 KB
testcase_30 AC 11 ms
5,948 KB
testcase_31 AC 11 ms
6,064 KB
testcase_32 AC 24 ms
6,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

a=N=input()+1;l,c,r=[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