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

Largest Point

Time 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
2 3 2 1 1 2 3 5 -1 0 -3 -3 0 3 3
 

Sample Output
Case #1: 20 Case #2: 0
 

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-11-22 12:52:34, Gzip enabled