logo AlgoBeat OnlineJudge
登录 注册

#217538. [ICPC 2018 Nanjing R] Magic Potion

内存限制:512 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

There are heroes and 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 -th hero can only kill one monster belonging to the set . Joe, the strategist, has 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.

输入格式

The first line contains three integers () the number of heroes, the number of monsters and the number of bottles of potion.

Each of the next lines contains one integer , the size of , and the following integers (), the indices (-based) of monsters that can be killed by the -th hero ().

输出格式

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

样例

样例输入 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