大和証券プログラミングコンテスト2021 (AtCoder Regular Contest 128)
C
Max Dot
AtCoder
⌀ 1810
原题
← BD →
翻译中…

Problem Statement

翻译中…

Given are integers $N$, $M$, $S$, and a sequence of $N$ integers $A=(A_1,A_2,\cdots,A_N)$.

翻译中…

Consider making a sequence of $N$ non-negative real numbers $x=(x_1,x_2,\cdots,x_N)$ satisfying all of the following conditions:

翻译中…
  • $0 \leq x_1 \leq x_2 \leq \cdots \leq x_N \leq M$,
  • $\sum_{1 \leq i \leq N} x_i=S$.
翻译中…

Now, let us define the score of $x$ as $\sum_{1 \leq i \leq N} A_i \times x_i$. Find the maximum possible score of $x$.

翻译中…

Constraints

翻译中…
  • $1 \leq N \leq 5000$
  • $1 \leq M \leq 10^6$
  • $1 \leq S \leq \min(N \times M,10^6)$
  • $1 \leq A_i \leq 10^6$
  • All values in input are integers.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N M S
A_1 A_2 \cdots A_N

翻译中…

Constraints

翻译中…

Print the answer. Your output will be considered correct if its absolute or relative error is at most $10^{-6}$.

翻译中…

样例

Input #1
3 2 3
1 2 3
Output #1
8.00000000000000000000
The optimal choice is $x=(0,1,2)$.
Input #2
3 3 2
5 1 1
Output #2
4.66666666666666666667
The optimal choice is $x=(2/3,2/3,2/3)$.
Input #3
10 234567 1000000
353239 53676 45485 617014 886590 423581 172670 928532 312338 981241
Output #3
676780145098.25000000000000000000
题目信息
题号
arc128_c
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。