Under construction

Still being built. Things may change

Cutting Straw Bundles

Time limit1sMemory limit1024 MB

Summary
Choose a straight cutting line across N straws of height H so the total quadrilateral area is at least S, minimizing the sum of f_i times each straw's area.
Level

Medium6 of 10

Topics
Math, Greedy, Geometry
Solved
No attempts yet

Problem

Kendo master Pidol will demonstrate straw bundle cutting in front of his juniors. There are N straws numbered 1 to N, and Pidol will perform an N-stage cut. Straw i is a rectangle with height H and width 1. An N-stage cut means cutting the bundle formed by placing these N straws side by side in numerical order without gaps, which is a rectangle with height H and width N.

A cut can be represented by a single straight line across the bundle. This line is called the cutting line. The cutting line must always pass through the left and right edges of the bundle. If the line passes through an endpoint of an edge, it still counts as passing through that edge.

Let the two top vertices of straw i be AiA_i and BiB_i from left to right, and let the points where the cutting line meets straw i be DiD_i and CiC_i from left to right. If the strength of straw i is fif_i, the force needed to cut straw i is fi×(area of quadrilateral AiBiCiDi)f_i \times (\text{area of quadrilateral } A_iB_iC_iD_i). In some cases AiA_i and DiD_i coincide, or BiB_i and CiC_i coincide. Then the area is computed as the area of a triangle instead of a quadrilateral.

Pidol wants to show a 'great N-stage cut'. For an N-stage cut to count as great, the sum ∑i=1N(area of quadrilateral AiBiCiDi)\sum_{i=1}^{N} (\text{area of quadrilateral } A_iB_iC_iD_i) must be at least SS. Find the minimum total force Pidol needs when he performs a great N-stage cut using the least force.

Input

The first line contains integers NN, HH, and SS separated by spaces. (1≤N,H≤105; 1≤S≤NH)(1 \le N, H \le 10^5;\ 1 \le S \le NH)

The second line contains integers f1,f2,f3,…,fNf_1, f_2, f_3, \dots, f_N separated by spaces. (1≤fi≤105)(1 \le f_i \le 10^5)

Output

On the first line, print the minimum force needed for a great N-stage cut. An absolute or relative error of up to 10−410^{-4} is accepted.

Examples3

  1. Example 1

    Input
    3 3 3
    1 1 1
    
    Expected output
    3.000000
    
  2. Example 2

    Input
    5 4 8
    1 2 3 2 1
    
    Expected output
    14.400000
    
  3. Example 3

    Input
    5 5 8
    1 6 3 8 3
    
    Expected output
    29.760000