結果

問題 No.3 ビットすごろく
ユーザー jamadjamad
提出日時 2017-08-13 05:25:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 241 bytes
コンパイル時間 193 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 63,616 KB
最終ジャッジ日時 2024-04-21 08:33:17
合計ジャッジ時間 5,524 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
10,752 KB
testcase_01 AC 34 ms
10,624 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 AC 36 ms
11,008 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 51 ms
12,288 KB
testcase_08 AC 87 ms
21,248 KB
testcase_09 AC 161 ms
36,992 KB
testcase_10 AC 200 ms
47,488 KB
testcase_11 AC 139 ms
33,152 KB
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 AC 229 ms
55,808 KB
testcase_17 AC 253 ms
60,800 KB
testcase_18 AC 42 ms
12,672 KB
testcase_19 AC 271 ms
63,616 KB
testcase_20 AC 34 ms
11,008 KB
testcase_21 AC 33 ms
10,624 KB
testcase_22 RE -
testcase_23 RE -
testcase_24 AC 260 ms
63,232 KB
testcase_25 AC 256 ms
62,336 KB
testcase_26 AC 34 ms
10,752 KB
testcase_27 AC 48 ms
13,952 KB
testcase_28 AC 228 ms
54,016 KB
testcase_29 AC 144 ms
33,664 KB
testcase_30 AC 33 ms
10,496 KB
testcase_31 AC 34 ms
10,624 KB
testcase_32 AC 134 ms
30,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def upd(x,t):
 if 0<x<=N and A[x]==[]:Q.append(x);A[x]=A[t]+[x]
    
def bfs():
 while Q:
  t=Q.pop(0)
  if t==N:return A[N]
  c=bin(t).count('1');upd(t+c,t);upd(t-c,t)
 return -1

N=int(input())
A=[[]]*10001
A[1]=[1]
Q=[1]
print(len(bfs()))
0