|
||||||||||
Largest PointTime Limit: 1500/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 4244 Accepted Submission(s): 1408 Problem Description Given the sequence $A$ with $n$ integers $t_1,t_2,\cdots,t_n$. Given the integral coefficients $a$ and $b$. The fact that select two elements $t_i$ and $t_j$ of $A$ and $i\neq j$ to maximize the value of $a t_i^2 + b t_j$, becomes the largest point. Input An positive integer $T$, indicating there are $T$ test cases. For each test case, the first line contains three integers corresponding to $n~(2\le n\le 5\times 10^6),~a~(0\le |a|\le 10^6)$ and $b~(0\le |b|\le 10^6)$. The second line contains $n$ integers $t_1,t_2,\cdots,t_n$ where $0\le |t_i|\le 10^6$ for $1\le i\le n$. The sum of $n$ for all cases would not be larger than $5 \times 10^6$. Output The output contains exactly $T$ lines. For each test case, you should output the maximum value of $a t_i^2 + b t_j$. Sample Input
Sample Output
Source | ||||||||||
|