F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

YJQQQAQ and the function

Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 311    Accepted Submission(s): 132


Problem Description
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.
 

Input
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.
 

Output
For each test case, the only line contains the only integer that is the maximum value of the function.
 

Sample Input
1 3 2 3 1
 

Sample Output
10
 

Hint

When and only when $l=1,r=2,k=1$, the value of the function is the maximum.
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-05-02 05:19:40, Gzip enabled