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

建议使用的浏览器:

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

4152:ZZY’s Dilemma

题目描述
ZZY has many habits like seeing movie, listening music, playing PC game and football and so on. Besides he has many goals, as not every habit is good for achieving his goals, he falls into the dilemma of making a choice between his goals and habits.
Now ,we define the effect that one habit has on each goal is represented as a vector,and the elements of the vector are integers,ex.vector(100,90,-10,80)means it has 100 point effect on goal 1,90 point effect on goal 2,-10 point effect on goal 3 and 80 point effect on goal 4(the positive point means good effect and the negative point means bad effect),and the given requirement of each goal is represented as integer.please help ZZY to achieve his goals as well as keeps his habits as many as possible.
输入解释
There are multi cases , read the data until EOF.( No more than 10 cases )
Line 1: The number of ZZY’s goals N(0<N<=20)
Line 2: The requirement of each goals (0 < w <= 1000)
Line 3: The number of ZZY’s habits M(0 < M <= 16)
Line 4-M+4: Each line contains N integers, the ith integer represents the effect on ith goal (-1000 <= data <= 1000).
输出解释
For each case: The output is a single line that contains:
* the maximum number of habits ZZY can keep, followed by:
* a SORTED list (from smallest to largest) of the habit ZZY can keep. If more than one set of habits could meet the requirement, choose the set with the smallest habit numbers.
Just please output 0 if there is no way to achieve ZZY’s goals.
输入样例
4
100 200 300 400
3
100 100 400 500
100 -10 50  300
100 100 -50  -50
输出样例
2 1 3
来自杭电HDUOJ的附加信息
Author ZZY@USC
Recommend lcy

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

源链接: HDU-4152

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

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 65535/32768K(Java/Others)