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

建议使用的浏览器:

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

3916:Sequence Decomposition

题目描述
A sequence can be decomposed into the sum of unit impulses, but we can still decompose the sequence into the sum of gate function which defined as
  
.
  For simplify we use G (a,b) to represent , Now the question is how to decompose the sequence to maximize the minimum length of gate function. (The length of is b – a + 1). For simplification, you just need to get the minimum length.
输入解释
The first integer T is the number of test cases
Each case starts with a number N followed by N integers a[i]  
(0<= T <= 10)
(0<= N <= 10000)
(0 <= a[i] <= 2^31)
(We ensure )
输出解释
The minimum length S
输入样例
2
6
2 3 4 3 3 1
5
2 2 2 2 2
输出样例
3
5
提示
The first case can be decomposed to G(1,5)+G(1,6)+G(2,5)+G(3,3), the minimum length is 1 and it can also be decomposed to G(1,3)+G(1,5)+G(2,6)+G(3,5), the minimum length is 3, so answer is 3.
The second case can be decomposed to 2*G (1, 5).
来自杭电HDUOJ的附加信息
Author Jianhe25
Recommend lcy

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

源链接: HDU-3916

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

共提交 0

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