結果

問題 No.2730 Two Types Luggage
ユーザー Nikkuniku029
提出日時 2024-04-20 06:38:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 922 ms / 2,000 ms
コード長 475 bytes
コンパイル時間 1,107 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 266,060 KB
最終ジャッジ日時 2024-10-12 01:47:04
合計ジャッジ時間 20,587 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import accumulate

N, M, W = map(int, input().split())
A = sorted(list(map(int, input().split())))[::-1]
B = list(map(int, input().split()))
C = list(map(int, input().split()))
cumA = list(accumulate(A, initial=0))
ans = 0
for i in range(1 << M):
    tmp = 0
    w = 0
    for j in range(M):
        if i & (1 << j):
            w += B[j]
            tmp += C[j]
    if w > W:
        continue
    tmp += cumA[min(W - w, N)]
    ans = max(ans, tmp)
print(ans)
0