問題一覧 > 通常問題

No.2730 Two Types Luggage

レベル : / AI推定難易度 : 575 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 164
作問者 : kusirakusira / テスター : 👑 AngrySadEight FplusFplusF hiro1729 みどりむし🦠
お気に入りにしたユーザー ProblemId : 10756 / 自分の提出
問題文最終更新日: 2024-04-13 00:47:05
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 428 (順位表) の他の問題:

Problem Statement

There are $N$ items of type X and $M$ items of type Y.
Each item of type X has weight $1$ and value $A_i$. $(1 \leqq i \leqq N)$
Each item of type Y has weight $B_j$ and value $C_j$. $(1 \leqq j \leqq M)$

You pack any number of these items into a knapsack.
When packing so that the total weight of the items is at most $W$, find the maximum possible total value of the packed items.

Input

The input is given from standard input in the following format.

$N\ M\ W$
$A_1\ A_2 \cdots A_N$
$B_1\ B_2 \cdots B_M$
$C_1\ C_2 \cdots C_M$
  • All inputs are integers.
  • $1 \leqq N \leqq 10^6$
  • $1 \leqq M \leqq 20$
  • $1 \leqq W \leqq 10^{15}$
  • $1 \leqq A_i \leqq 10^9 (1 \leqq i \leqq N)$
  • $1 \leqq B_j, C_j \leqq 10^9 (1 \leqq j \leqq M)$

Output

Output the answer.

Sample

Sample 1
Input
3 2 3
10 20 15
2 3
100 10
Output
120

Packing the type X item with weight $1$ and value $20$
and the type Y item with weight $2$ and value $100$
gives a value of $120$, which is the maximum.

Sample 2
Input
4 3 5
1 2 3 4
100 200 100
100 200 500
Output
10

All of the type X items can be packed, but none of the type Y items can be packed.

Sample 3
Input
10 10 30
3 1 4 1 5 9 2 6 5 3
3 1 4 1 5 9 2 6 5 3
3 1 4 1 5 9 2 6 5 3
Output
59

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。