結果

問題 No.733 分身並列コーディング
ユーザー convexineqconvexineq
提出日時 2021-03-17 17:43:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 695 ms / 1,500 ms
コード長 437 bytes
コンパイル時間 212 ms
コンパイル使用メモリ 82,532 KB
実行使用メモリ 67,928 KB
最終ジャッジ日時 2024-04-27 09:19:35
合計ジャッジ時間 9,302 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
53,432 KB
testcase_01 AC 45 ms
52,924 KB
testcase_02 AC 38 ms
52,704 KB
testcase_03 AC 250 ms
64,468 KB
testcase_04 AC 241 ms
64,484 KB
testcase_05 AC 48 ms
62,176 KB
testcase_06 AC 38 ms
52,632 KB
testcase_07 AC 289 ms
65,324 KB
testcase_08 AC 226 ms
66,692 KB
testcase_09 AC 118 ms
65,044 KB
testcase_10 AC 54 ms
62,516 KB
testcase_11 AC 52 ms
62,204 KB
testcase_12 AC 40 ms
52,728 KB
testcase_13 AC 38 ms
53,420 KB
testcase_14 AC 79 ms
63,768 KB
testcase_15 AC 55 ms
64,816 KB
testcase_16 AC 38 ms
52,948 KB
testcase_17 AC 39 ms
52,760 KB
testcase_18 AC 56 ms
64,632 KB
testcase_19 AC 138 ms
65,916 KB
testcase_20 AC 138 ms
64,768 KB
testcase_21 AC 71 ms
63,504 KB
testcase_22 AC 303 ms
65,412 KB
testcase_23 AC 72 ms
63,080 KB
testcase_24 AC 83 ms
65,020 KB
testcase_25 AC 46 ms
61,964 KB
testcase_26 AC 38 ms
53,292 KB
testcase_27 AC 55 ms
63,268 KB
testcase_28 AC 261 ms
65,128 KB
testcase_29 AC 575 ms
66,536 KB
testcase_30 AC 307 ms
66,296 KB
testcase_31 AC 695 ms
66,984 KB
testcase_32 AC 74 ms
63,716 KB
testcase_33 AC 61 ms
64,364 KB
testcase_34 AC 72 ms
64,364 KB
testcase_35 AC 64 ms
64,212 KB
testcase_36 AC 81 ms
65,368 KB
testcase_37 AC 72 ms
63,960 KB
testcase_38 AC 307 ms
66,268 KB
testcase_39 AC 306 ms
66,416 KB
testcase_40 AC 306 ms
66,432 KB
testcase_41 AC 64 ms
64,420 KB
testcase_42 AC 63 ms
64,044 KB
testcase_43 AC 62 ms
64,440 KB
testcase_44 AC 312 ms
67,144 KB
testcase_45 AC 306 ms
66,584 KB
testcase_46 AC 309 ms
67,928 KB
testcase_47 AC 306 ms
67,076 KB
testcase_48 AC 307 ms
66,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T,n,*a = map(int,open(0).read().split())
N = 1<<n
lst = [0]*N
for i in range(n):
    for j in range(1<<i):
        lst[j+(1<<i)] = lst[j] + a[i]
for i in range(N):
    lst[i] = int(lst[i] <= T)

dp = [n+9]*N
dp[0] = 0
for mask in range(1,N):
    if lst[mask]:
        dp[mask] = 1
        continue
    j = mask
    mmask = mask&(mask-1)
    while j:
        dp[mask] = min(dp[mask],dp[j]+dp[mask^j])
        j = (j-1)&mmask
print(dp[-1])
0