結果

問題 No.2730 Two Types Luggage
コンテスト
ユーザー norioc
提出日時 2025-10-23 02:56:08
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 609 ms / 2,000 ms
+ 673µs
コード長 528 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 243 ms
コンパイル使用メモリ 95,856 KB
実行使用メモリ 305,860 KB
最終ジャッジ日時 2026-07-15 20:25:56
合計ジャッジ時間 13,918 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from itertools import accumulate

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()))

acc = list(accumulate(sorted(A, reverse=True)))
ans = 0
for i in range(1 << M):
    w = v = 0
    for j in range(M):
        if ~i & (1 << j): continue
        w += B[j]
        v += C[j]
        if w > W: break

    if w <= W:
        cnt = W-w
        if cnt > 0:
            v += acc[min(cnt-1, len(acc)-1)]
        ans = max(ans, v)

print(ans)
0