7450: New Equipments

内存限制:128 MB 时间限制:2 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:19 通过:2

题目描述

Little Q’s factory recently purchased m pieces of new equipment, labeled by 1, 2, . . . , m.
There are n workers in the factory, labeled by 1, 2, . . . , n. Each worker can be assigned to no more than
one piece of equipment, and no piece of equipment can be assigned to multiple workers. If Little Q assigns
the i-th worker to the j-th piece of equipment, he will need to pay ai × j2 + bi × j + ci dollars.
Now please for every k (1 ≤ k ≤ n) fifind k pairs of workers and pieces of equipment, then assign workers
to these pieces of equipment, such that the total cost for these k workers is minimized.

输入格式


The first line of the input contains a single integer T(1≤T≤10), the number of test cases.

For each case, the first line of the input contains two integers nand m(1≤n≤50, n≤m≤108), denoting the number of workers and the number of pieces of equipment.

Each of the following nlines contains three integers ai,biand ci(1≤ai≤10, 10^8≤bi≤10^8, 0≤ci≤10^16, b^2i≤4aici), denoting a worker.


输出格式

For each test case, output a single line containing n integers, the k-th (1 ≤ k ≤ n) of which denoting the
minimum possible total cost for k pairs of workers and pieces of equipment.

输入样例 复制

1
3 5
2 3 10
2 -3 10
1 -1 4

输出样例 复制

4 15 37

分类标签