QOJ.ac

QOJ

Time Limit: 2.0 s Memory Limit: 512 MB Total points: 100 Hackable ✓

#16259. Another $n$-dimensional chocolate bar

Statistics

Mom bought Vasya an $n$-dimensional chocolate bar, which is an $n$-dimensional cube with each side length equal to $1$. The chocolate is marked for division into segments. Along the $i$-th dimension, it can be divided by hyperplanes into $a_i$ equal parts. Thus, the chocolate is divided into a total of $a_1 \cdot a_2 \cdot \dots \cdot a_n$ segments, where the length of each segment along the $i$-th dimension is $\frac{1}{a_i}$, and consequently, the volume of each segment is $\frac{1}{a_1 a_2 \dots a_n}$.

Vasya and his friends want to cut the chocolate to obtain at least $k$ pieces, while maximizing the volume of the smallest piece. The chocolate can only be cut at the boundaries of the segments, and each cut must pass through the entire chocolate along a hyperplane involved in the formation of the segments. Only after making all the cuts does Vasya break the chocolate into pieces.

More formally, Vasya wants to choose numbers $b_1, b_2, \dots, b_n$ ($1 \le b_i \le a_i$) — the number of parts into which Vasya will cut the chocolate along each dimension. The condition $b_1 \cdot b_2 \cdot \dots \cdot b_n \ge k$ must be satisfied to obtain at least $k$ pieces after all cuts. It can be noted that with an optimal cutting strategy using these parameters, the smallest piece will contain $\frac{a_1}{b_1} \cdot \dots \cdot \frac{a_n}{b_n}$ segments, and its volume will be equal to $\left( \frac{a_1}{b_1} \cdot \dots \cdot \frac{a_n}{b_n} \right) \cdot \frac{1}{a_1 a_2 \dots a_n}$.

Vasya wants to obtain the maximum possible value of the volume of the smallest piece multiplied by $k$, that is, he wants to maximize the number $\left( \frac{a_1}{b_1} \cdot \dots \cdot \frac{a_n}{b_n} \right) \cdot \frac{1}{a_1 a_2 \dots a_n} \cdot k$. Help him with this.

Input

The first line contains two integers $n$ and $k$ ($1 \le n \le 100$, $1 \le k \le 10^7$) — the dimension of the chocolate and the number of pieces it needs to be divided into.

The second line contains $n$ integers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 10^7$) — the number of segments into which the chocolate is marked along each dimension.

Output

Output a single number — the maximum possible volume of the smallest piece obtained, multiplied by $k$, with an absolute or relative error of no more than $10^{-9}$.

If it is impossible to cut the chocolate into at least $k$ pieces under the given constraints, output $0$.

Examples

Input 1

1 2
5

Output 1

0.8

Input 2

2 6
5 10

Output 2

0.72

Input 3

2 7
4 4

Output 3

0.875

Input 4

2 3
4 5

Output 4

0.75

Input 5

4 444
57 179 239 2

Output 5

0.97557326850704739751

Input 6

2 5
2 2

Output 6

0

Note

In the first example, a one-dimensional chocolate bar can be divided as follows: Then the answer is $\frac{2}{5} \cdot 2 = 0.8$.

In the second example, the chocolate can be cut as follows: Then the answer is $\frac{2}{5} \cdot \frac{3}{10} \cdot 6 = 0.72$.

In the third example, the chocolate can be cut as follows: Then the answer is $\frac{2}{4} \cdot \frac{1}{4} \cdot 7 = 0.875$.

Subtasks

Group Points Additional Constraints Required Groups Comment
0 0 - - Sample tests.
1 10 $n \le 2$ -
2 12 $k \le 500$, $a_i \le 500$ 0
3 13 $k \le 20\,000$, $a_i \le 2000$ 0, 2
4 12 $k \le 40\,000$ 0, 2, 3
5 10 $k \le 200\,000$ 0, 2, 3, 4
6 11 $k \le 4 \cdot 10^6$, $a_i \le 2000$ 0, 2, 3
7 15 $k \le 5 \cdot 10^6$ 0, 2 - 6
8 17 - 0 - 7 Offline testing.

Figure 1. One-dimensional chocolate bar division

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.