結果

問題 No.2730 Two Types Luggage
ユーザー prd_xxxprd_xxx
提出日時 2024-04-19 21:32:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 865 ms / 2,000 ms
コード長 475 bytes
コンパイル時間 212 ms
コンパイル使用メモリ 82,292 KB
実行使用メモリ 268,896 KB
最終ジャッジ日時 2024-10-11 14:10:41
合計ジャッジ時間 14,334 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M,W = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort(reverse=True)
cums = [0]
for a in A:
    cums.append(cums[-1] + a)

ans = 0
for b in range(1<<M):
    w = v = 0
    for i in range(M):
        if b&(1<<i):
            w += B[i]
            v += C[i]
            if w > W:
                break
    else:
        rem = min(W - w, N)
        ans = max(ans, cums[rem] + v)
print(ans)
0