atcoder#ARC128C. [ARC128C] Max Dot

[ARC128C] Max Dot

Score : 600600 points

Problem Statement

Given are integers NN, MM, SS, and a sequence of NN integers A=(A1,A2,,AN)A=(A_1,A_2,\cdots,A_N).

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

  • 0x1x2xNM0 \leq x_1 \leq x_2 \leq \cdots \leq x_N \leq M,
  • 1iNxi=S\sum_{1 \leq i \leq N} x_i=S.

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

Constraints

  • 1N50001 \leq N \leq 5000
  • 1M1061 \leq M \leq 10^6
  • 1Smin(N×M,106)1 \leq S \leq \min(N \times M,10^6)
  • 1Ai1061 \leq A_i \leq 10^6
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN MM SS

A1A_1 A2A_2 \cdots ANA_N

Constraints

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

3 2 3
1 2 3
8.00000000000000000000

The optimal choice is x=(0,1,2)x=(0,1,2).

3 3 2
5 1 1
4.66666666666666666667

The optimal choice is x=(2/3,2/3,2/3)x=(2/3,2/3,2/3).

10 234567 1000000
353239 53676 45485 617014 886590 423581 172670 928532 312338 981241
676780145098.25000000000000000000