atcoder#ABC183D. [ABC183D] Water Heater
[ABC183D] Water Heater
Score : points
Problem Statement
We have a water heater, which supplies liters of hot water per minute.
There are people. The -th person plans to use liters of hot water per minute boiled by the heater from Time to (excluding at Time 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
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
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 and , the -nd, -rd, and -th persons plan to use , , and liter(s) of hot water per minute, for a total of liters per minute.
The water heater can only supply 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