#t503. 最小函数值
最小函数值
Minimum Function Value
Problem Background
Special for beginners, ^_^
Problem Description
There are functions . They are defined as (). Given , find the smallest values among all the function values produced by all the functions (output a value as many times as it occurs if there are duplicates).
Input Format
The first line contains two positive integers and .
The following lines each contain three positive integers: the -th line gives , and . The input guarantees , , .
Output Format
Output the first elements after sorting all the function values that can be generated by the functions. These numbers should be printed on one line, separated by spaces.
Sample Input
3 10
4 5 3
3 4 5
1 7 1
Sample Output
9 12 12 19 25 29 31 44 45 54
Constraints
Time limit: 1s; memory limit: 1024 KiB for each test case. .