#P7536. [COCI 2016/2017 #4] Rekonstruiraj

[COCI 2016/2017 #4] Rekonstruiraj

Description

Given a closed interval [A,B][A,B] and an initially empty set. In each operation, choose a real number xx, and add to the set all real numbers among 0,x,2x,3x,4x,0,x,2x,3x,4x,\cdots that lie within the closed interval [A,B][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 KK, the number of real numbers in the final set.

The second line contains two integers A,BA,B, indicating that only real numbers within the closed interval [A,B][A,B] will be added.

Each of the next KK lines contains a real number with at most 55 digits after the decimal point. It is guaranteed that these KK real numbers are strictly increasing.

Output Format

Output NN lines, where NN is the number of operations in your plan.

In the next NN lines, output one real number per line. These NN real numbers represent the chosen real numbers for the NN 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.

4
1 2
1
1.4
1.5
2
0.5
0.7
5
10 25
12
13.5
18
20.25
24
6.0
6.75

Hint

[Explanation for Sample 1]

Another valid plan is to choose the real numbers 0.50.5 and 1.41.4.

[Constraints]

For 50%50\% of the testdata, all input integers are natural numbers.

For 100%100\% of the testdata, 1K501 \le K \le 50 and 1AB1061 \le A \le B \le 10^6.

[Hints and Notes]

This problem uses a self-written Special Judge. You are welcome to hack it (submit a general problem-report ticket).

Translated from COCI 2016-2017 CONTEST #4 T4 Rekonstruiraj.

The score of this problem follows the original COCI settings, with a full score of 120120.

Translated by ChatGPT 5