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

建议使用的浏览器:

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

5064:Find Sequence

题目描述
Give you an positive integer sequence $a_1, a_2, \ldots, a_i, \ldots, a_n$, and they satisfy $a_1+a_2+ \ldots +a_i+ \ldots +a_n = M(0<M \leq 2^{22})$.
We can find new sequence $b_1=a_{id_1}, b_2=a_{id_2}, \ldots, b_x=a_{id_x}, \ldots, b_y=a_{id_y}, \ldots, b_t =a_{id_t}$, where if x != y then $id_x != id_y$. and this sequence satisfy:
(1) $b_1 \leq b_2 \leq \ldots \leq b_t$
(2) $b_2-b_1 \leq b_3-b_2 \leq \dots \leq b_t-b_{t-1}$
We can find many sequences $b_1, b_2, b_3, \ldots, b_t$. But we only want to know maximum t.
输入解释
The first line in the input file is an Integer $T(1 \leq T \leq 30)$.
The first line of each test case contains two integer $n, M(0<M \leq 2^{22})$.
Then a line have n integer, they represent $a_1, a_2, \ldots, a_i, \ldots, a_n$.
输出解释
For each test case, output the maximum t.
输入样例
2
6 19
3 2 1 3 4 6
1 4194304
4194304
输出样例
5
1
提示
For the first testcase, The Sequence is 1 2 3 4 6
来自杭电HDUOJ的附加信息
Recommend heyang

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

题目来源 BestCoder Round #13

源链接: HDU-5064

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

共提交 0

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