atcoder#ABC183D. [ABC183D] Water Heater

[ABC183D] Water Heater

Score : 400400 points

Problem Statement

We have a water heater, which supplies WW liters of hot water per minute.

There are NN people. The ii-th person plans to use PiP_i liters of hot water per minute boiled by the heater from Time SiS_i to TiT_i (excluding at Time TiT_i exactly). As hot water gets cold fast, it cannot be stored.

Is it possible to supply hot water to the people according to their plans?

Constraints

  • 1N2×1051\leq N \leq 2\times 10^5
  • 0Si<Ti2×1050\leq S_i < T_i \leq 2\times 10^5
  • 1W,Pi1091\leq W, P_i \leq 10^9
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN WW

S1S_1 T1T_1 P1P_1

\vdots

SNS_N TNT_N PNP_N

Output

If it is possible to supply hot water to the people according to their plans, print Yes; otherwise, print No.

4 10
1 3 5
2 4 4
3 10 6
2 4 1
No

Between Time 33 and 44, the 22-nd, 33-rd, and 44-th persons plan to use 44, 66, and 11 liter(s) of hot water per minute, for a total of 1111 liters per minute.

The water heater can only supply 1010 liters of hot water per minute, which is not enough.

4 10
1 3 5
2 4 4
3 10 6
2 3 1
Yes
6 1000000000
0 200000 999999999
2 20 1
20 200 1
200 2000 1
2000 20000 1
20000 200000 1
Yes