#P2085. Minimum m Function Values
Minimum m Function Values
Minimum m Function Values
You are given n quadratic functions:
\( F_i(x)=A_i x^2+B_i x+C_i, \quad \text{for } x\in\mathbb{N}^* \quad (1\le i\le n) \)
Each function is defined on the set of positive integers. Your task is to output the smallest m values among the values of all the functions (if there are duplicate values, output each occurrence).
Note: It is guaranteed that for all functions, Ai > 0
, so that each function is convex and attains a minimum on \(\mathbb{N}^*\). For each function, the minimum value is attained at a positive integer \(x\) near \(\displaystyle x=-\frac{B_i}{2A_i}\). You may generate the function values in increasing order by merging two sequences (one in the upward direction and one in the downward direction from the minimum point).
inputFormat
The first line contains two integers n and m.
Then n lines follow. Each line contains three integers: Ai
, Bi
and Ci
for the i-th function.
outputFormat
Output m integers in non-decreasing order separated by spaces, representing the smallest m function values among all functions.
sample
1 3
1 -2 1
0 1 4
</p>