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

建议使用的浏览器:

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

6396:Swordsman

题目描述
Lawson is a magic swordsman with $k$ kinds of magic attributes $v_1, v_2, v_3, \dots, v_k$. Now Lawson is faced with $n$ monsters and the $i$-th monster also has $k$ kinds of defensive attributes $a_{i,1}, a_{i,2}, a_{i,3}, \dots, a_{i, k}$. If $v_1\geq a_{i,1}$ and $v_2\geq a_{i,2}$ and $v_3\geq a_{i,3}$ and $\dots$ and $v_k\geq a_{i, k}$, Lawson can kill the $i$-th monster (each monster can be killed for at most one time) and get EXP from the battle, which means $v_j$ will increase $b_{i,j}$ for $j = 1, 2, 3, \dots, k$.
Now we want to know how many monsters Lawson can kill at most and how much Lawson's magic attributes can be maximized.
输入解释
There are multiple test cases. The first line of input contains an integer $T$, indicating the number of test cases. For each test case:
The first line has two integers $n$ and $k$ ($1\leq n \leq 10^5, 1\leq k \leq 5$).
The second line has $k$ non-negative integers (initial magic attributes) $v_1, v_2, v_3, \dots, v_k$.
For the next $n$ lines, the $i$-th line contains $2k$ non-negative integers $a_{i,1}, a_{i,2}, a_{i,3}, \dots, a_{i, k}, b_{i,1}, b_{i,2}, b_{i,3}, \dots, b_{i, k}$.
It's guaranteed that all input integers are no more than $10^9$ and $v_j + \displaystyle\sum_{i=1}^n b_{i,j} \leq 10^9$ for $j = 1, 2, 3, \dots, k$.

It is guaranteed that the sum of all n $\leq 5 \times 10 ^ 5$.
The input data is very large so fast IO (like `fread`) is recommended.
输出解释
For each test case:
The first line has one integer which means the maximum number of monsters that can be killed by Lawson.
The second line has $k$ integers $v_1', v_2', v_3', \dots, v_k'$ and the $i$-th integer means maximum of the $i$-th magic attibute.
输入样例
1
4 3
7 1 1
5 5 2 6 3 1
24 1 1 1 2 1
0 4 1 5 1 1
6 0 1 5 3 1
输出样例
3
23 8 4

提示
For the sample, initial V = [7, 1, 1]
① kill monster #4 (6, 0, 1), V + [5, 3, 1] = [12, 4, 2]
② kill monster #3 (0, 4, 1), V + [5, 1, 1] = [17, 5, 3]
③ kill monster #1 (5, 5, 2), V + [6, 3, 1] = [23, 8, 4]
After three battles, Lawson are still not able to kill monster #2 (24, 1, 1)
because 23 < 24.
来自杭电HDUOJ的附加信息
Recommend chendu

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

源链接: HDU-6396

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

共提交 0

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