AtCoder Beginner Contest 183
翻译中…
Problem Statement
翻译中…
We have a water heater, which supplies $W$ liters of hot water per minute.
翻译中…
There are $N$ people. The $i$-th person plans to use $P_i$ liters of hot water per minute boiled by the heater from Time $S_i$ to $T_i$ (excluding at Time $T_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
翻译中…
$1\leq N \leq 2\times 10^5$$0\leq S_i < T_i \leq 2\times 10^5$$1\leq W, P_i \leq 10^9$- All values in input are integers.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
N W
S_1 T_1 P_1
\vdots
S_N T_N P_N
翻译中…
Output
翻译中…
If it is possible to supply hot water to the people according to their plans, print Yes; otherwise, print No.
翻译中…
样例
Input #1
4 10
1 3 5
2 4 4
3 10 6
2 4 1
Output #1
No
Between Time $3$ and $4$, the $2$-nd, $3$-rd, and $4$-th persons plan to use $4$, $6$, and $1$ liter(s) of hot water per minute, for a total of $11$ liters per minute.
The water heater can only supply $10$ liters of hot water per minute, which is not enough.
Input #2
4 10
1 3 5
2 4 4
3 10 6
2 3 1
Output #2
Yes
Input #3
6 1000000000
0 200000 999999999
2 20 1
20 200 1
200 2000 1
2000 20000 1
20000 200000 1
Output #3
Yes
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。