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

建议使用的浏览器:

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

5662:YJQQQAQ and the function

题目描述
YJQQQAQ has an array $A$ of length $n$. He defines a function $f_{l,r,k}$ where $l,r,k$ are positive integers that satisfies $l\leq r$ and $r\times k\leq n$, and the value of the function equals to $p\times q\times\lfloor\sqrt{k}\rfloor$ where $p$ equals to the sum value of $A_{l\times k},A_{\left(l+1\right)\times k},...,A_{r\times k}$ and $q$ equals to the minimal value of them. YJQQQAQ wants to choose the positive integers $l,r,k$ carefully to maximize the value of the function.
输入解释
The first line contains an integer $T\left(1\leq T\leq 3\right)$——The number of the test cases. For each test case:
The first line contains an integers $n\left(1\leq n\leq300,000\right)$.
The second line contains $n$ integers describing the given array $A$, the $i$th integer is $A_i\left(1\leq A_i\leq1,000,000\right)$. Between each two adjacent integers there is a white space separated.
输出解释
For each test case, the only line contains the only integer that is the maximum value of the function.
输入样例
1
3
2 3 1
输出样例
10

提示
When and only when $l=1,r=2,k=1$, the value of the function is the maximum.
来自杭电HDUOJ的附加信息
Recommend wange2014

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

源链接: HDU-5662

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

共提交 0

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