$$ \newcommand{\seq}[2]{{#1}_{1},{#1}_{2},\cdots,{#1}_{#2}} \newcommand{\num}[1]{1,2,\cdots,#1} \newcommand{\stra}[2]{\begin{bmatrix}#1 \\ #2\end{bmatrix}} \newcommand{\strb}[2]{\begin{Bmatrix}#1 \\ #2\end{Bmatrix}} \newcommand{\dw}[1]{\underline{#1}} \newcommand{\up}[1]{\overline{#1}} $$

Codeforces 514

514 D

题意

\(n\) 个机器人,有 \(m\) 个属性,最多可攻击 \(k\) 次,每次可对所有机器人的第 \(i\) 个属性攻击一次,属性非负。如果一个机器人所有属性为 \(0\) ,则这个机器人就挂了。
输出第 \(i\) 个属性需要攻击多少次。
( \(1 ≤ n ≤ 10^5, 1 ≤ m ≤ 5, 0 ≤ k ≤ 10^9\) )

Examples

Input
5 2 4
4 0
1 2
2 1
0 2
1 3
Output
2 2
Input
3 2 4
1 2
1 3
2 2
Output
1 3

用two-pointers扫区间,对于一个区间,如果该区间内所有属性的最大值的和小于等于k,那么就是合法的。用ST表维护。

514 E

posted @ 2019-02-12 19:33  chc_1234567890  阅读(137)  评论(0编辑  收藏  举报