P17663 [IO 2025 #3] Wednesday's Terrifying Experiment
Description
In her latest spooky experiment, Wednesday decided to use mysterious sequences. She discovered that certain combinations of numbers hold a dark hidden harmony that can be expressed as the sum of three mysterious fractions. She wants to find the triple of numbers in the array with the smallest total energy, because too much energy would kill the victim instantly, and she wants the victim to suffer for a long time before dying.
Repeat this experiment: find three pairwise distinct indices $i,j,k$ such that
$$
\frac{a_i}{a_k}+\frac{a_j}{a_i}+\frac{a_k}{a_j}
$$
is as small as possible. Output the minimum value of this sum.
Remember that, as with everything related to dark energy, the tiniest error can lead to terrible consequences, so your answer must differ from the true answer by no more than $10^{-9}$.
Input Format
The first line contains an integer $n$, satisfying $3\le n\le 2\cdot 10^5$.
The second line contains $n$ integers $a_i$, satisfying $1\le a_i\le 10^9$.
Output Format
Output the answer in one line.
Your answer is considered correct if its absolute error from the correct answer does not exceed $10^{-9}$. That is, if your answer is $\mathrm{ans}_p$ and the correct answer is $\mathrm{ans}_j$, then $|\mathrm{ans}_p-\mathrm{ans}_j|\le 10^{-9}$ must hold.
Explanation/Hint
Translated by QwenWork