QOJ.ac

QOJ

Time Limit: 1.0 s Memory Limit: 1024 MB Total points: 100 Hackable ✓

#8979. 魔法药水

Statistics

岛上有 $n$ 个英雄和 $m$ 个怪物。最近怪物变得非常凶残,因此英雄们决定消灭岛上的怪物。然而,第 $i$ 个英雄只能杀死属于集合 $M_i$ 的怪物。战略家 Joe 有 $k$ 瓶魔法药水,每一瓶都可以增强一名英雄的能力,使他能够多杀死一个怪物。由于药水威力巨大,每名英雄最多只能服用一瓶药水。

请帮助 Joe 计算在采取最优策略的情况下,英雄们最多能杀死多少只怪物。

输入格式

第一行包含三个整数 $n, m, k$ ($1 \le n, m, k \le 500$),分别表示英雄的数量、怪物的数量和药水的瓶数。

接下来的 $n$ 行,每行包含一个整数 $t_i$(表示集合 $M_i$ 的大小),以及随后的 $t_i$ 个整数 $M_{i,j}$ ($1 \le j \le t_i$),表示第 $i$ 个英雄可以杀死的怪物编号(从 1 开始计数,$1 \le t_i \le m, 1 \le M_{i,j} \le m$)。

输出格式

输出英雄们最多能杀死的怪物数量。

样例

样例输入 1

3 5 2
4 1 2 3 5
2 2 5
2 1 2

样例输出 1

4

样例输入 2

5 10 2
2 3 10
5 1 3 4 6 10
5 3 4 6 8 9
3 1 9 10
5 1 3 6 7 10

样例输出 2

7

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.