```cpp
#include<bits/stdc++.h>
using namespace std;
#define ll long long
inline ll gi()
{
ll a=0;char x=getchar();bool f=0;
while((x>'9'||x<'0')&&x!='-')x=getchar();
if(x=='-')f=1,x=getchar();
while(x>='0'&&x<='9')a=a*10+x-48,x=getchar();
return f?-a:a;
}
ll n,m,a,b,c;
priority_queue<ll>q;
int main()
{
n=gi(),m=gi();
for(int i=1;i<=n;i++)
{
a=gi(),b=gi(),c=gi();
int mid=(-b)/2/a;
if(mid<=0)mid=1;
for(int i=1;i<=sqrt(m);i++)q.push(-(a*mid*mid+b*mid+c)),mid++;
}
while(m--)printf("%lld ",-q.top()),q.pop();
return 0;
}
```cpp
by 浅色调 @ 2017-10-09 17:01:51
牛逼
by fyfy @ 2017-10-09 17:07:02
@[浅色调](/space/show?uid=44000) 何止是乱写,啥算法都不用只用sort都能过。。。。
by Victorique @ 2017-10-09 19:05:30