結果

問題 No.2730 Two Types Luggage
ユーザー tkykwtnb
提出日時 2024-04-20 12:52:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 835 ms / 2,000 ms
コード長 430 bytes
コンパイル時間 210 ms
コンパイル使用メモリ 82,264 KB
実行使用メモリ 267,396 KB
最終ジャッジ日時 2024-10-12 08:16:12
合計ジャッジ時間 14,501 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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)
cumA=[0 for _ in range(N+1)]
for i in range(N):
    cumA[i]=cumA[i-1]+A[i]
ans=0
for i in range(2**M):
    w=0;v=0
    for j in range(M):
        if i>>j&1:w+=B[j];v+=C[j]
    if w<W:
        dw=min(N,W-w)
        w+=dw
        v+=cumA[dw-1]
    if w<=W:ans=max(ans,v)
print(ans)
0