#P17326. [ICPC 2018 Nanjing R] Magic Potion

    ID: 19668 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 显示难度提高+/省选− 上传者: 标签>2018网络流图论建模ICPC南京

[ICPC 2018 Nanjing R] Magic Potion

Problem Description

There are nn heroes and mm monsters living in an island. The monsters became very vicious these days, so the heroes decided to diminish the monsters in the island. However, the ii-th hero can only kill one monster belonging to the set MiM_i. Joe, the strategist, has kk bottles of magic potion, each of which can buff one hero's power and let him be able to kill one more monster. Since the potion is very powerful, a hero can only take at most one bottle of potion.

Please help Joe find out the maximum number of monsters that can be killed by the heroes if he uses the optimal strategy.

Input Format

The first line contains three integers n,m,kn, m, k (1n,m,k5001 \le n, m, k \le 500) \text{---} the number of heroes, the number of monsters and the number of bottles of potion.

Each of the next nn lines contains one integer tit_i, the size of MiM_i, and the following tit_{i} integers Mi,jM_{i, j} (1jti1 \le j \le t_i), the indices (11-based) of monsters that can be killed by the ii-th hero (1tim,1Mi,jm1 \le t_i\le m, 1\leq M_{i, j} \le m).

Output Format

Print the maximum number of monsters that can be killed by the heroes.

3 5 2
4 1 2 3 5
2 2 5
2 1 2
4
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
7