D. 最小函数值

    Type: Default 1000ms 128MiB

最小函数值

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

nn个函数,分别为F1,F2,...,FnF_1,F_2,...,F_n。定义Fi(x)=Aix2+Bix+Ci(xN)F_i(x)=A_i x^2+B_i x+C_i ( x ∈N^*) 。给定这些AiBiA_i、B_iCiC_i,请求出所有函数的所有函数值中最小的mm个(如有重复的要输出多个)。

输入

第一行输入两个正整数nnmm

以下nn行每行三个正整数,其中第ii行的三个数分别位AiA_iBiB_iCiC_i。输入数据保证Ai10Bi100Ci10000A_i≤10,B_i≤100,C_i≤10000

输出

将这nn个函数所有可以生成的函数值排序后的前mm个元素。这mm个数应该输出到一行,用空格隔开。

样例

3 10
4 5 3
3 4 5
1 7 1
9 12 12 19 25 29 31 44 45 54

提示

n,m10000n,m≤10000

竞赛A班3.23日

Not Attended
Status
Done
Rule
IOI
Problem
4
Start at
2025-3-23 14:00
End at
2025-3-30 14:00
Duration
168 hour(s)
Host
Partic.
4