atcoder#ABC265B. [ABC265B] Explore
[ABC265B] Explore
Score : points
Problem Statement
Takahashi is exploring a cave in a video game.
The cave consists of rooms arranged in a row. The rooms are numbered Room from the entrance.
Takahashi is initially in Room , and the time limit is . For each , he may consume a time of to move from Room to Room . There is no other way to move between rooms. He cannot make a move that makes the time limit or less.
There are bonus rooms in the cave. The -th bonus room is Room ; when he arrives at the room, the time limit increases by .
Can Takahashi reach Room ?
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
If Takahashi can reach Room , print Yes
; otherwise, print No
.
4 1 10
5 7 5
2 10
Yes
- Takahashi is initially in Room , and the time limit is .
- He consumes a time of to move to Room . Now the time limit is . Then, the time limit increases by ; it is now .
- He consumes a time of to move to Room . Now the time limit is .
- He consumes a time of to move to Room . Now the time limit is .
4 1 10
10 7 5
2 10
No
He cannot move from Room to Room .