#LC001. #A.红绿灯
#A.红绿灯
Title Description
There is a straight east-west main road in City C, which can be seen as a one-dimensional coordinate axis with the east as the positive direction. The westernmost coordinate of the road is .
There are traffic lights on the road, and the coordinates of the -th traffic light are . The duration of the red light is , and the duration of the green light is g-i. Each traffic light works according to the pattern of "red light second, green light second". For example, if , , then the th traffic light is a red light between second and second, switches to a green light between second and second, switches to a red light between second and second, and so on.
When someone is preparing to drive east from the westernmost point of the road (at coordinates ), their car has a speed limit . Before departure, they can fix the speed to any integer from to (including and ), so that the car will maintain a speed of after starting at (excluding the starting time of the car, i.e. for any real number , the coordinates of the car at seconds of departure are ), and cannot brake or accelerate.
If a car encounters a traffic light while it is at a red light, it will be penalized, but if it is at a green light or when the red light switches between green lights, it will not be penalized. Given that all traffic lights have just switched from green to red at the departure time of , please calculate all feasible vehicle speeds so that the vehicle can safely pass through all traffic lights.
Input format
The first line contains two positive integers separated by spaces, representing the number of traffic lights and the maximum speed limit of the vehicle, respectively.
Next, there are rows, each containing three positive integers separated by spaces, representing the coordinates of the -th traffic light, the red light time, and the green light time, respectively. Ensure that the coordinates of any two traffic lights are not the same.
Output format
Output a line of all feasible vehicle speeds in ascending order, separated by a space between every two numbers. The data ensures at least one feasible vehicle speed.
Example
2 10
9 2 1
7 2 5
1 3
Example Description
If , a red light with coordinates of will be encountered. If , a red light with coordinates of will be encountered; Therefore, can only be .
Data scale and agreement
For data of ,$1\le n\le 2,1\le u\le 10,1\le x_i\le 10,1\le r_i\le 10,1\le g_i\le 1e9$;
For data of , $1 \le n \le 10000, \le u \le 100, 1\le x_i\le 1e9, 1\le r_i\le 1e9,1\le g_i\le 1e9$.