結果

問題 No.2730 Two Types Luggage
ユーザー rarpipipirarpipipi
提出日時 2024-04-20 08:55:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 847 ms / 2,000 ms
コード長 458 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 268,048 KB
最終ジャッジ日時 2024-10-12 04:18:57
合計ジャッジ時間 15,373 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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())),reverse=True)
acc=[0]+list(accumulate(a))
b=list(map(int,input().split()))
c=list(map(int,input().split()))

ans=acc[min(n,w)]

for i in range(1,1<<m):
    sum_w=0
    v=0
    for j in range(m):
        if i>>j&1==1:
            sum_w+=b[j]
            v+=c[j]

    if sum_w>w:
        continue
    v+=acc[min((w-sum_w),n)]
    ans=max(ans,v)

print(ans)
0