当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3185:Dead Or Alive

题目描述
Only several people survive after Doomsday, and a small number of cities have not been destroyed. yifenfei wants to arrange these people to live on the available cities.
Now all the people follow yifenfei to pass the cities.
But there are some restrictions on the cities. Some people will die when pass some cities and every city has a population limitation. If people can’t find a city to live after passing all cities they will be dead! So the order of passing the cities is important.
输入解释
The first line an integer T (1<=T<=100) which means the number of test cases.
Each case starts with two integers n and m, which means the number of people and the number of cities. (1<= n <= 31, 1 <= m <= 10)
Second line has m integers, the ith integer Ci means ith city’s population limitation. The cities are ordered from 0 to m-1. (1 <= Ci <= 6)
Then n lines follow. Each line starts with an integer k which means the number of cities this people will die when passing it. Then k integers follow.
输出解释
The maximum number of people can survive!
输入样例
2
3 3
3 3 2
1 1
0
2 1 2
3 3
2 1 2
2 0 1
2 0 2
1 2
输出样例
3
2
来自杭电HDUOJ的附加信息
Recommend lcy

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-3185

最后修改于 2020-10-25T23:01:01+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
20000/10000MS(Java/Others) 32768/32768K(Java/Others)