#P15077. [ICPC 2024 Chengdu R] Double 11
[ICPC 2024 Chengdu R] Double 11
题目描述
With the Double 11 Shopping Festival approaching, a store is managing its best-selling products for the event.
There are types of best-selling products, and the daily sales volume for each type is . Products need to be replenished multiple times to meet sales demand, and due to limited warehouse space, the total inventory must not exceed the storage capacity.
If only one type of product is replenished at a time, the workload becomes too high. To optimize replenishment, the store decides to divide the product types into groups, assigning a replenishment parameter to each group. For group , the replenishment parameter is a positive real number, which means for each product type in this group, a volume of will be prepared for each replenishment, and it will be replenished times per day on average. Note that can be either greater than, less than or equal to .
Let be the group index of product type . The maximum inventory in the warehouse can be represented by . Due to the warehouse capacity limitation, this value cannot exceed .
Your task is to find a scheme that divides the product types into groups and assigns a replenishment parameter to each group such that the total number of replenishments per day is minimized while satisfying the warehouse capacity limitation, i.e., minimize , subject to . For convenience, you should output the square root of the minimal answer, i.e., . Note that you can assign the same replenishment parameters to different groups.
输入格式
The first line contains two integers and (), indicating the number of product types and the number of groups.
The second line contains integers (), indicating the sales volume of product type .
输出格式
Output one real number, indicating the answer. Your output will be considered correct if the relative or absolute error does not exceed .
4 2
1 2 3 4
6.1911471295571
10 3
1 2 3 4 5 6 7 8 9 10
22.5916253665141
提示
For the first example, let $k_1=\frac{1}{3+\sqrt{21}}, k_2=\frac{1}{7+\sqrt{21}}$, and . We will get the maximum inventory as , and the total number of replenishments is . Therefore, the answer is , which is the minimum.