結果

問題 No.2730 Two Types Luggage
ユーザー ryohei22
提出日時 2024-05-03 21:58:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 820 ms / 2,000 ms
コード長 419 bytes
コンパイル時間 427 ms
コンパイル使用メモリ 82,404 KB
実行使用メモリ 270,420 KB
最終ジャッジ日時 2024-11-25 02:45:32
合計ジャッジ時間 15,425 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_left


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

s = [0]
for i in A:
	s.append(s[-1]+i)

ans = 0
for i in range(2**M):
	w = v = 0
	for j in range(M):
		if (i >> j) & 1:
			w += B[j]
			v += C[j]
	if W < w:
		continue
	v += s[min(W-w, N)]
	ans = max(ans, v)
print(ans)
0