P7536 [COCI 2016/2017 #4] Rekonstruiraj

Description

Given a closed interval $[A,B]$ and an initially empty set. In each operation, choose a real number $x$, and add to the set all real numbers among $0,x,2x,3x,4x,\cdots$ that lie within the closed interval $[A,B]$ (duplicate numbers in the set are kept only once). Now you are given all real numbers in the final set. Find a plan such that, with the minimum number of operations, the set after performing the operations is exactly the same as the given set.

Input Format

The first line contains an integer $K$, the number of real numbers in the final set. The second line contains two integers $A,B$, indicating that only real numbers within the closed interval $[A,B]$ will be added. Each of the next $K$ lines contains a real number with at most $5$ digits after the decimal point. It is guaranteed that these $K$ real numbers are strictly increasing.

Output Format

Output $N$ lines, where $N$ is the number of operations in your plan. In the next $N$ lines, output one real number per line. These $N$ real numbers represent the chosen real numbers for the $N$ operations, in order. The output order does not matter. If there are multiple valid plans, output one with the minimum number of operations. If there are multiple plans with the minimum number of operations, output any one of them.

Explanation/Hint

**[Explanation for Sample 1]** Another valid plan is to choose the real numbers $0.5$ and $1.4$. **[Constraints]** For $50\%$ of the testdata, all input integers are natural numbers. For $100\%$ of the testdata, $1 \le K \le 50$ and $1 \le A \le B \le 10^6$. **[Hints and Notes]** This problem uses a self-written [Special Judge](https://www.luogu.com.cn/paste/gchfnvo0). You are welcome to hack it (submit a general problem-report ticket). **Translated from [COCI 2016-2017](https://hsin.hr/coci/archive/2016_2017/) [CONTEST #4](https://hsin.hr/coci/archive/2016_2017/contest4_tasks.pdf) _T4 Rekonstruiraj_.** **The score of this problem follows the original COCI settings, with a full score of $120$.** Translated by ChatGPT 5