結果

問題 No.733 分身並列コーディング
ユーザー ああいいああいい
提出日時 2022-06-12 20:13:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 616 ms / 1,500 ms
コード長 480 bytes
コンパイル時間 227 ms
コンパイル使用メモリ 81,576 KB
実行使用メモリ 71,296 KB
最終ジャッジ日時 2023-10-24 14:27:14
合計ジャッジ時間 15,863 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,356 KB
testcase_01 AC 36 ms
53,356 KB
testcase_02 AC 35 ms
53,356 KB
testcase_03 AC 616 ms
69,216 KB
testcase_04 AC 606 ms
69,220 KB
testcase_05 AC 606 ms
69,228 KB
testcase_06 AC 36 ms
53,356 KB
testcase_07 AC 611 ms
71,296 KB
testcase_08 AC 611 ms
71,296 KB
testcase_09 AC 249 ms
66,736 KB
testcase_10 AC 56 ms
62,128 KB
testcase_11 AC 54 ms
62,112 KB
testcase_12 AC 35 ms
53,356 KB
testcase_13 AC 34 ms
53,356 KB
testcase_14 AC 111 ms
64,356 KB
testcase_15 AC 49 ms
62,052 KB
testcase_16 AC 35 ms
53,356 KB
testcase_17 AC 38 ms
59,460 KB
testcase_18 AC 55 ms
64,180 KB
testcase_19 AC 245 ms
66,724 KB
testcase_20 AC 247 ms
66,744 KB
testcase_21 AC 113 ms
64,356 KB
testcase_22 AC 613 ms
71,296 KB
testcase_23 AC 115 ms
64,376 KB
testcase_24 AC 114 ms
64,376 KB
testcase_25 AC 45 ms
62,048 KB
testcase_26 AC 34 ms
53,356 KB
testcase_27 AC 48 ms
62,052 KB
testcase_28 AC 610 ms
71,296 KB
testcase_29 AC 611 ms
71,296 KB
testcase_30 AC 612 ms
71,296 KB
testcase_31 AC 613 ms
71,296 KB
testcase_32 AC 73 ms
64,120 KB
testcase_33 AC 71 ms
64,120 KB
testcase_34 AC 71 ms
64,120 KB
testcase_35 AC 71 ms
64,120 KB
testcase_36 AC 70 ms
64,120 KB
testcase_37 AC 70 ms
64,120 KB
testcase_38 AC 612 ms
71,296 KB
testcase_39 AC 616 ms
71,296 KB
testcase_40 AC 613 ms
71,296 KB
testcase_41 AC 72 ms
64,120 KB
testcase_42 AC 71 ms
64,120 KB
testcase_43 AC 72 ms
64,120 KB
testcase_44 AC 612 ms
71,296 KB
testcase_45 AC 613 ms
71,296 KB
testcase_46 AC 612 ms
71,296 KB
testcase_47 AC 612 ms
71,296 KB
testcase_48 AC 611 ms
71,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())
N = int(input())
t = [int(input()) for _ in range(N)]
inf = 32
dp = [inf] * (1 << N)
for bit in range(1,1 << N):
    tmp = 0
    for i in range(N):
        if bit >> i & 1:
            tmp += t[i]
    if tmp <= T:
        dp[bit] = 1
for bit in range(1,1 << N):
    tmp = inf
    T = bit
    while T:
        T -= 1
        T &= bit
        u = dp[T] + dp[bit ^ T]
        if u < tmp:
            tmp = u
    if tmp < dp[bit]:
        dp[bit] = tmp
print(dp[-1])
0