結果

問題 No.2730 Two Types Luggage
コンテスト
ユーザー Nikkuniku029
提出日時 2024-04-20 06:38:57
言語 PyPy3
(8.0.0 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 555 ms / 2,000 ms
+ 347µs
コード長 475 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 84 ms
コンパイル使用メモリ 64,936 KB
実行使用メモリ 200,220 KB
最終ジャッジ日時 2026-10-16 00:34:53
合計ジャッジ時間 14,218 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from itertools import accumulate

N, M, W = map(int, input().split())
A = sorted(list(map(int, input().split())))[::-1]
B = list(map(int, input().split()))
C = list(map(int, input().split()))
cumA = list(accumulate(A, initial=0))
ans = 0
for i in range(1 << M):
    tmp = 0
    w = 0
    for j in range(M):
        if i & (1 << j):
            w += B[j]
            tmp += C[j]
    if w > W:
        continue
    tmp += cumA[min(W - w, N)]
    ans = max(ans, tmp)
print(ans)
0