結果

問題 No.733 分身並列コーディング
ユーザー tktk_snsntktk_snsn
提出日時 2021-01-28 23:53:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 476 ms / 1,500 ms
コード長 474 bytes
コンパイル時間 639 ms
コンパイル使用メモリ 86,864 KB
実行使用メモリ 77,324 KB
最終ジャッジ日時 2023-09-08 14:28:39
合計ジャッジ時間 14,750 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,296 KB
testcase_01 AC 75 ms
71,180 KB
testcase_02 AC 75 ms
71,356 KB
testcase_03 AC 454 ms
77,120 KB
testcase_04 AC 450 ms
77,232 KB
testcase_05 AC 445 ms
77,104 KB
testcase_06 AC 77 ms
71,184 KB
testcase_07 AC 448 ms
77,316 KB
testcase_08 AC 447 ms
77,300 KB
testcase_09 AC 272 ms
76,600 KB
testcase_10 AC 94 ms
76,288 KB
testcase_11 AC 96 ms
76,164 KB
testcase_12 AC 78 ms
71,156 KB
testcase_13 AC 74 ms
71,244 KB
testcase_14 AC 128 ms
76,544 KB
testcase_15 AC 90 ms
76,192 KB
testcase_16 AC 76 ms
71,464 KB
testcase_17 AC 79 ms
75,528 KB
testcase_18 AC 95 ms
76,196 KB
testcase_19 AC 226 ms
76,668 KB
testcase_20 AC 223 ms
76,672 KB
testcase_21 AC 130 ms
76,464 KB
testcase_22 AC 458 ms
77,032 KB
testcase_23 AC 135 ms
76,512 KB
testcase_24 AC 130 ms
76,420 KB
testcase_25 AC 86 ms
76,284 KB
testcase_26 AC 75 ms
71,172 KB
testcase_27 AC 88 ms
76,144 KB
testcase_28 AC 469 ms
77,136 KB
testcase_29 AC 451 ms
77,260 KB
testcase_30 AC 450 ms
77,324 KB
testcase_31 AC 452 ms
77,280 KB
testcase_32 AC 105 ms
76,140 KB
testcase_33 AC 109 ms
76,292 KB
testcase_34 AC 107 ms
76,084 KB
testcase_35 AC 108 ms
76,252 KB
testcase_36 AC 103 ms
76,096 KB
testcase_37 AC 108 ms
76,288 KB
testcase_38 AC 476 ms
77,324 KB
testcase_39 AC 451 ms
77,316 KB
testcase_40 AC 450 ms
77,220 KB
testcase_41 AC 106 ms
76,248 KB
testcase_42 AC 108 ms
76,340 KB
testcase_43 AC 108 ms
76,096 KB
testcase_44 AC 472 ms
77,168 KB
testcase_45 AC 476 ms
77,196 KB
testcase_46 AC 476 ms
77,208 KB
testcase_47 AC 452 ms
77,136 KB
testcase_48 AC 452 ms
77,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

T = int(input())
N = int(input())
A = [int(input()) for _ in range(N)]

dp = [N] * (1 << N)
dp[0] = 0
for S in range(1, 1 << N):
    time = 0
    for i, t in enumerate(A):
        if (S >> i) & 1:
            time += t
    if time <= T:
        dp[S] = 1

for S in range(1, 1 << N):
    T = S
    while T:
        dp[S] = min(dp[S], dp[T] + dp[S ^ T])
        T = (T - 1) & S
print(dp[(1 << N)-1])
0