結果

問題 No.2730 Two Types Luggage
ユーザー 👑 rin204
提出日時 2024-04-20 01:10:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 830 ms / 2,000 ms
コード長 466 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 82,132 KB
実行使用メモリ 267,468 KB
最終ジャッジ日時 2024-10-11 19:58:55
合計ジャッジ時間 15,240 ms
ジャッジサーバーID
(参考情報)
judge3 / 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)
cum = [0] * (n + 1)
for i in range(n):
    cum[i + 1] = cum[i] + A[i]

ans = 0
for bit in range(1 << m):
    w = 0
    v = 0
    for i in range(m):
        if bit >> i & 1:
            w += B[i]
            v += C[i]
    if w <= W:
        v += cum[min(n, W - w)]
        ans = max(ans, v)
print(ans)
0