結果

問題 No.2730 Two Types Luggage
ユーザー なえしら
提出日時 2024-08-13 23:38:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 843 ms / 2,000 ms
コード長 428 bytes
コンパイル時間 706 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 268,652 KB
最終ジャッジ日時 2024-08-13 23:38:33
合計ジャッジ時間 16,159 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import accumulate

N, M, W = map(int, input().split())
A = list(accumulate(sorted(map(int,
  input().split()), reverse=True), initial=0))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = 0
for S in range(1<<M):
  wgt = val = 0
  for i in range(M):
    if S>>i&1 == 0: continue
    wgt += B[i]; val += C[i]
  if wgt > W: continue
  ans = max(ans, val + A[min(W - wgt, N)])

print(ans)
0