結果

問題 No.733 分身並列コーディング
ユーザー rlangevinrlangevin
提出日時 2023-08-31 12:29:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 757 ms / 1,500 ms
コード長 429 bytes
コンパイル時間 626 ms
コンパイル使用メモリ 87,164 KB
実行使用メモリ 77,532 KB
最終ジャッジ日時 2023-08-31 12:29:57
合計ジャッジ時間 18,365 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,256 KB
testcase_01 AC 71 ms
70,932 KB
testcase_02 AC 72 ms
71,192 KB
testcase_03 AC 757 ms
77,460 KB
testcase_04 AC 728 ms
77,464 KB
testcase_05 AC 102 ms
77,288 KB
testcase_06 AC 69 ms
71,160 KB
testcase_07 AC 653 ms
77,188 KB
testcase_08 AC 585 ms
77,024 KB
testcase_09 AC 276 ms
76,956 KB
testcase_10 AC 89 ms
76,256 KB
testcase_11 AC 96 ms
76,248 KB
testcase_12 AC 69 ms
70,916 KB
testcase_13 AC 69 ms
71,132 KB
testcase_14 AC 154 ms
76,360 KB
testcase_15 AC 84 ms
76,428 KB
testcase_16 AC 70 ms
71,148 KB
testcase_17 AC 72 ms
75,660 KB
testcase_18 AC 97 ms
76,164 KB
testcase_19 AC 457 ms
76,452 KB
testcase_20 AC 295 ms
76,696 KB
testcase_21 AC 159 ms
76,700 KB
testcase_22 AC 745 ms
77,200 KB
testcase_23 AC 158 ms
76,716 KB
testcase_24 AC 156 ms
76,412 KB
testcase_25 AC 80 ms
76,200 KB
testcase_26 AC 69 ms
71,052 KB
testcase_27 AC 87 ms
76,436 KB
testcase_28 AC 549 ms
77,348 KB
testcase_29 AC 660 ms
77,476 KB
testcase_30 AC 635 ms
77,324 KB
testcase_31 AC 665 ms
77,280 KB
testcase_32 AC 108 ms
76,264 KB
testcase_33 AC 108 ms
76,472 KB
testcase_34 AC 109 ms
75,956 KB
testcase_35 AC 108 ms
76,128 KB
testcase_36 AC 109 ms
76,248 KB
testcase_37 AC 108 ms
75,948 KB
testcase_38 AC 662 ms
77,508 KB
testcase_39 AC 624 ms
77,484 KB
testcase_40 AC 649 ms
77,408 KB
testcase_41 AC 108 ms
76,296 KB
testcase_42 AC 106 ms
76,236 KB
testcase_43 AC 106 ms
76,372 KB
testcase_44 AC 653 ms
77,188 KB
testcase_45 AC 638 ms
77,152 KB
testcase_46 AC 652 ms
77,432 KB
testcase_47 AC 637 ms
77,436 KB
testcase_48 AC 660 ms
77,532 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())
N = int(input())
t = [0] * N
for i in range(N):
    t[i] = int(input())

inf = 10 ** 18
N2 = 1 << N
dp = [inf] * N2
for s in range(1, N2):
    v = 0
    for i in range(N):
        if (s >> i) & 1:
            v += t[i]
    if v <= T:
        dp[s] = 1
        continue
    sub = s
    while sub:
        nokori = s ^ sub
        dp[s] = min(dp[s], dp[sub] + dp[nokori])
        sub = (sub - 1) & s

print(dp[-1])
0