結果

問題 No.2730 Two Types Luggage
ユーザー hotate29
提出日時 2024-04-19 21:40:50
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 487 bytes
コンパイル時間 1,401 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 133,100 KB
最終ジャッジ日時 2024-10-11 14:28:01
合計ジャッジ時間 7,162 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9 TLE * 1 -- * 25
権限があれば一括ダウンロードができます

ソースコード

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)
sa = [0]
for ai in a:
    sa.append(sa[-1] + ai)

ans = 0

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

    if weight > w:
        continue

    value += sa[min(w - weight, n)]
    ans = max(ans, value)

print(ans)
0