結果

問題 No.3 ビットすごろく
ユーザー ebicochinealebicochineal
提出日時 2017-02-08 12:12:39
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 40 ms / 5,000 ms
コード長 175 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 10,504 KB
実行使用メモリ 8,728 KB
最終ジャッジ日時 2023-09-14 00:19:39
合計ジャッジ時間 2,085 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,752 KB
testcase_01 AC 15 ms
7,800 KB
testcase_02 AC 16 ms
7,800 KB
testcase_03 AC 22 ms
8,188 KB
testcase_04 AC 17 ms
7,796 KB
testcase_05 AC 27 ms
8,436 KB
testcase_06 AC 20 ms
8,192 KB
testcase_07 AC 17 ms
7,736 KB
testcase_08 AC 24 ms
8,340 KB
testcase_09 AC 31 ms
8,508 KB
testcase_10 AC 34 ms
8,672 KB
testcase_11 AC 30 ms
8,404 KB
testcase_12 AC 28 ms
8,408 KB
testcase_13 AC 19 ms
8,136 KB
testcase_14 AC 35 ms
8,688 KB
testcase_15 AC 40 ms
8,596 KB
testcase_16 AC 36 ms
8,596 KB
testcase_17 AC 37 ms
8,704 KB
testcase_18 AC 18 ms
7,740 KB
testcase_19 AC 38 ms
8,584 KB
testcase_20 AC 15 ms
7,720 KB
testcase_21 AC 15 ms
7,792 KB
testcase_22 AC 37 ms
8,728 KB
testcase_23 AC 40 ms
8,712 KB
testcase_24 AC 39 ms
8,588 KB
testcase_25 AC 38 ms
8,676 KB
testcase_26 AC 14 ms
7,708 KB
testcase_27 AC 19 ms
8,216 KB
testcase_28 AC 36 ms
8,704 KB
testcase_29 AC 30 ms
8,524 KB
testcase_30 AC 16 ms
7,736 KB
testcase_31 AC 16 ms
7,752 KB
testcase_32 AC 29 ms
8,356 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

a=N=int(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