#P2085. 最小函数值

最小函数值

Description

There are nn functions, denoted F1,F2,,FnF_1, F_2, \dots, F_n. Define Fi(x)=Aix2+Bix+CiF_i(x) = A_i x^2 + B_i x + C_i for xNx \in \mathbb{N}^*. Given these AiA_i, BiB_i, and CiC_i, find the smallest mm values among all function values of all functions (if there are duplicates, output them multiple times).

Input Format

The first line contains two positive integers nn and mm.

Each of the following nn lines contains three integers; on the ii-th line they are AiA_i, BiB_i, and CiC_i.

Output Format

Output the first mm elements of the sorted sequence of all function values generated by the nn functions. Print these mm numbers on one line, separated by spaces.

3 10
4 5 3
3 4 5
1 7 1

9 12 12 19 25 29 31 44 45 54

Hint

Constraints

For all test points, it is guaranteed that 1n,m100001 \leq n, m \leq 10000, 1Ai101 \leq A_i \leq 10, 0Bi1000 \leq B_i \leq 100, 0Ci1040 \leq C_i \leq 10^4.

Translated by ChatGPT 5