#P7286. 「EZEC-5」人赢
「EZEC-5」人赢
Description
Xiao has an array indexed from to .
Xiao defines $f(x,y)=\begin{cases} \min(k_x,k_y) \times (x + y) &x \ne y \\ k_x\times x&x=y \end{cases}$.
Xiao wants to know, for any , what the maximum value of is. But she cannot solve it, so she asked the kind Xiao Z. However, Xiao Z, who really wanted to impress the girl, found that he could not solve it either, so he can only ask for help from kind you.
Input Format
The first line contains an integer .
The second line contains integers , where the -th integer is . The meaning is as described above.
Output Format
Output one integer in one line, representing the maximum value of over all .
3
3 2 1
6
5
3 4 5 4 3
28
Hint
Constraints
This problem uses bundled testdata.
-
Subtask 1 (20 points): .
-
Subtask 2 (10 points): It is guaranteed that all are equal.
-
Subtask 3 (20 points): .
-
Subtask 4 (50 points): No special properties.
For of the testdata, , .
Enhanced version of this problem: link。
Translated by ChatGPT 5
京公网安备 11011102002149号