結果
| 問題 |
No.2730 Two Types Luggage
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-20 07:47:33 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 918 ms / 2,000 ms |
| コード長 | 749 bytes |
| コンパイル時間 | 266 ms |
| コンパイル使用メモリ | 82,596 KB |
| 実行使用メモリ | 271,564 KB |
| 最終ジャッジ日時 | 2024-10-12 03:04:36 |
| 合計ジャッジ時間 | 20,822 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 35 |
ソースコード
import typing
import sys
from collections import defaultdict
input = lambda: sys.stdin.readline().strip()
inf = 10**18
mod = 998244353
# import pypyjit
# pypyjit.set_param('max_unroll_recursion=-1')
# sys.setrecursionlimit(10**6)
def solve():
N, M, W = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
acc = [0]
for a in A:
acc.append(a+acc[-1])
B = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
for s in range(1<<M):
v = w = 0
for i in range(M):
if (s >> i)&1:
v += C[i]
w += B[i]
if w > W:
continue
v += acc[min(N, W-w)]
ans = max(ans, v)
print(ans)
def main():
t = 1
for _ in range(t):
solve()
main()