結果

問題 No.2730 Two Types Luggage
コンテスト
ユーザー prd_xxx
提出日時 2024-04-19 21:32:15
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 584 ms / 2,000 ms
+ 686µs
コード長 475 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 71 ms
コンパイル使用メモリ 81,408 KB
実行使用メモリ 321,864 KB
最終ジャッジ日時 2026-09-14 01:13:53
合計ジャッジ時間 15,856 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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