結果

問題 No.3 ビットすごろく
ユーザー ebicochinealebicochineal
提出日時 2017-02-07 20:28:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 42 ms / 5,000 ms
コード長 177 bytes
コンパイル時間 81 ms
コンパイル使用メモリ 10,548 KB
実行使用メモリ 8,712 KB
最終ジャッジ日時 2023-09-14 00:19:27
合計ジャッジ時間 2,126 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,748 KB
testcase_01 AC 15 ms
7,740 KB
testcase_02 AC 14 ms
7,708 KB
testcase_03 AC 23 ms
8,188 KB
testcase_04 AC 18 ms
7,792 KB
testcase_05 AC 31 ms
8,340 KB
testcase_06 AC 21 ms
8,180 KB
testcase_07 AC 18 ms
7,792 KB
testcase_08 AC 25 ms
8,340 KB
testcase_09 AC 33 ms
8,472 KB
testcase_10 AC 35 ms
8,696 KB
testcase_11 AC 29 ms
8,424 KB
testcase_12 AC 28 ms
8,444 KB
testcase_13 AC 20 ms
8,132 KB
testcase_14 AC 39 ms
8,712 KB
testcase_15 AC 40 ms
8,640 KB
testcase_16 AC 36 ms
8,656 KB
testcase_17 AC 37 ms
8,708 KB
testcase_18 AC 18 ms
7,752 KB
testcase_19 AC 39 ms
8,680 KB
testcase_20 AC 16 ms
7,804 KB
testcase_21 AC 15 ms
7,788 KB
testcase_22 AC 37 ms
8,600 KB
testcase_23 AC 42 ms
8,584 KB
testcase_24 AC 39 ms
8,600 KB
testcase_25 AC 39 ms
8,688 KB
testcase_26 AC 15 ms
7,732 KB
testcase_27 AC 19 ms
8,192 KB
testcase_28 AC 35 ms
8,652 KB
testcase_29 AC 29 ms
8,512 KB
testcase_30 AC 14 ms
7,708 KB
testcase_31 AC 15 ms
7,848 KB
testcase_32 AC 30 ms
8,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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