P29034 [洛谷] Ygg's Question Bank
提高
题目描述

Background

Ygg's question bank has crashed again!

Problem Description

Ygg has decided to use his divine power to forcibly reset his question bank. However, the question bank, built by Ygg himself, is not to be underestimated. When this intelligent question bank realizes it is about to be reset, it quickly changes the administrator password to prevent the reset.

Ygg discovers this intelligent entity and immediately imprisons it. But the administrator password of the question bank has already been modified, and Ygg is very troubled because his divine power cannot help him crack the password.

Ygg studies this intelligent entity and finds that it stores an array \( P \) of length \( n \) consisting of floating-point numbers in its mind. According to it, connecting each number in \( P \) rounded to five decimal places with spaces forms the password for the question bank. However, the intelligent entity refuses to reveal what \( P \) actually is.

Ygg further investigates and discovers that the intelligent entity considers a number \( X \) to be beautiful if and only if
$$ \sum_{i=0}^{n-1} P_i \cdot X^i > 0 $$
Thus, Ygg provides the intelligent entity with \( m \) numbers to inquire whether they are beautiful or not. Ygg hopes to deduce the array \( P \) from this data to retrieve the password of the question bank.

Since the answer is not unique, you only need to output any valid solution. See the Notes/Hints for details.

Input Format

The first line contains two integers \( n \) and \( m \).

The next \( m \) lines each contain a floating-point number \( a \) and a boolean value (0/1), representing whether the intelligent entity considers \( a \) to be beautiful.

Output Format

One line containing \( n \) floating-point numbers, representing the array \( P \) (rounded to five decimal places and connected with spaces).

The answer is not unique, but you need to ensure that the absolute value of each number in the array \( P \) is within 5000.

Sample Input and Output

Sample Input #1

5 5
-2.6 0
-1.8 0
0.6 1
0 0
1 1

Sample Output #1

-1.90000 2.60000 0.80000 1.70000 0.66600

Sample Input #2

4 10
4995.35 1
-341.076 0
2658.4 1
-1624.69 0
2856.53 1
3746.43 1
3454.28 1
1560.6 1
3785.31 1
-580.728 0

Sample Output #2

670.15800 4361.39000 3761.88000 4575.00000

Notes

\( 1 \le n \le 32 \), \( 15 \le m \le 4,000 \), \( -5,000 \le a_i \le 5,000 \), \( -5,000 \le P_i \le 5,000 \)

Since there may be multiple solutions, this problem uses a Special Judge to verify the answers. If the solution provided by the contestant satisfies all input conditions or the error is less than or equal to 5, full marks can be obtained; otherwise, the score for that test point will be \(\text{total score value} \cdot \frac{\text{correct count}}{\text{total count}}\).

The data ranges are as follows:

Data Point \( n \) \( m \)
\( 1\sim 10 \) \( 1 \le n \le 4 \) \( 15 \le m \le 20 \)
\( 11\sim 20 \) \( 4 \le n \le 32 \) \( 15 \le m \le 4,000 \)
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
5 5 -2.6 0 -1.8 0 0.6 1 0 0 1 1
样例输出
-1.90000 2.60000 0.80000 1.70000 0.66600