結果

問題 No.2730 Two Types Luggage
ユーザー loop0919loop0919
提出日時 2024-04-19 21:42:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 953 ms / 2,000 ms
コード長 597 bytes
コンパイル時間 418 ms
コンパイル使用メモリ 81,792 KB
実行使用メモリ 268,604 KB
最終ジャッジ日時 2024-04-19 21:42:54
合計ジャッジ時間 15,635 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
51,968 KB
testcase_01 AC 33 ms
51,968 KB
testcase_02 AC 48 ms
64,896 KB
testcase_03 AC 34 ms
52,096 KB
testcase_04 AC 91 ms
75,776 KB
testcase_05 AC 65 ms
75,704 KB
testcase_06 AC 40 ms
58,368 KB
testcase_07 AC 33 ms
51,840 KB
testcase_08 AC 38 ms
52,224 KB
testcase_09 AC 76 ms
75,776 KB
testcase_10 AC 48 ms
68,736 KB
testcase_11 AC 394 ms
232,172 KB
testcase_12 AC 883 ms
266,664 KB
testcase_13 AC 324 ms
215,056 KB
testcase_14 AC 366 ms
232,432 KB
testcase_15 AC 587 ms
106,880 KB
testcase_16 AC 216 ms
140,768 KB
testcase_17 AC 449 ms
263,084 KB
testcase_18 AC 409 ms
256,924 KB
testcase_19 AC 68 ms
85,120 KB
testcase_20 AC 215 ms
156,584 KB
testcase_21 AC 374 ms
241,424 KB
testcase_22 AC 453 ms
265,548 KB
testcase_23 AC 126 ms
94,848 KB
testcase_24 AC 272 ms
177,456 KB
testcase_25 AC 358 ms
229,952 KB
testcase_26 AC 133 ms
115,220 KB
testcase_27 AC 368 ms
240,392 KB
testcase_28 AC 231 ms
168,500 KB
testcase_29 AC 410 ms
258,904 KB
testcase_30 AC 513 ms
94,848 KB
testcase_31 AC 333 ms
211,000 KB
testcase_32 AC 262 ms
173,464 KB
testcase_33 AC 953 ms
267,452 KB
testcase_34 AC 893 ms
268,216 KB
testcase_35 AC 923 ms
268,452 KB
testcase_36 AC 949 ms
268,604 KB
testcase_37 AC 948 ms
267,884 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import combinations, accumulate

N, M, W = map(int, input().split())
A = sorted(map(int, input().split()), reverse=True)
B = list(map(int, input().split()))
C = list(map(int, input().split()))

acc_A = [0] + list(accumulate(A))

ans = acc_A[min(W, N)]

for i in range(1, M+1):
    for comb in combinations(zip(B, C), r=i):
        sum_weight = sum([b for b, _ in comb])
        sum_value = sum([c for _, c in comb])
        
        if sum_weight > W:
            continue
        
        value = sum_value + acc_A[min(W - sum_weight, N)]
        ans = max(ans, value)

print(ans)
0