QOJ.ac

QOJ

時間限制: 2 s 記憶體限制: 256 MB 總分: 100

#8865. 蛋糕

统计

当地的蛋糕店正在制定未来几个月的商业计划。烘焙师们有 $C$ 种不同的食谱,每种食谱都需要各自的一套配料和工具。在烘焙过程中,配料会被消耗,但工具不会,且可以重复用于其他食谱。目前,烘焙店没有任何配料或工具——它们要么在最近的洪水中被毁,要么被税务局没收了。

主厨的儿子成功说服大家,每种类型的蛋糕只烘焙一次。互联网上的个人似乎很乐意支付额外的费用,以成为他们独一无二的“坚果软糖塔”(Nutty-Fudge Tart, NFT)的唯一拥有者。事实上,主厨的儿子已经预先估算出了每种蛋糕可以赚取的金额。现在,烘焙师们正在商量决定制作哪些类型的蛋糕以获得最大利润。给定所有配料、工具的成本以及蛋糕的售价,你的任务是确定烘焙师们能获得的最大利润。

输入格式

第一行包含三个整数:$G$、$C$ 和 $T$,分别代表配料的数量、食谱的数量以及不同工具的数量。 第二行包含 $C$ 个以空格分隔的整数 $c_1, \dots, c_C$,表示每种蛋糕的售价。 第三行包含 $G$ 个以空格分隔的整数 $g_1, \dots, g_G$,表示每种配料的价格。 第四行包含 $T$ 个以空格分隔的整数 $t_1, \dots, t_T$,表示所有工具的价格。

接下来是 $C$ 行,每行包含 $G$ 个以空格分隔的整数 $a_{i,j}$,对应于制作第 $i$ 种蛋糕所需的第 $j$ 种配料的数量。

最后是 $C$ 行,格式如下:第 $i$ 行以一个整数 $n_i$ 开头,表示第 $i$ 种蛋糕所需的工具数量。随后是 $n_i$ 个以空格分隔的整数 $b_{i,k}$,表示制作第 $i$ 种蛋糕需要工具 $b_{i,k}$(所列工具各不相同)。

数据范围

  • $1 \le G, C, T \le 200$
  • $0 \le c_i, t_i \le 10^9$
  • $0 \le g_j, a_{i,j} \le 10^8$
  • $0 \le n_i \le T$
  • $1 \le b_{i,k} \le T$

输出格式

输出一个整数,表示蛋糕店能获得的最大利润。

样例

输入 1

5 3 4
14 18 21
1 2 3 1 2
5 6 3 10
0 0 1 2 0
1 2 0 1 2
5 2 1 0 0
2 1 2
2 2 3
2 3 4

输出 1

3

说明 1

通过制作第 1 种和第 2 种蛋糕(不制作第 3 种)可以获得最大利润。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.