Orecart Boba Easy

면접 대비

시간 제한1초메모리 제한2048 MB

요약
오레카트보다 앞서지 않으면서 최대 속도 v로 이동하는 사람이 증가하는 위치의 정류장마다 정해진 대기 시간을 채우고 모든 정류장을 들러 오레카트와 동시에 도착할 수 있는지 판정한다.
난이도

보통10점 중 6점

유형
그리디, 배열, 수학, 이분 탐색
정답자
아직 제출이 없습니다

문제

The only difference between this version and the hard version is that in this version, the maximum speed vv is provided as input.

Eugin and Kelly are celebrating E-Days at the Colorado School of Mines by participating in the annual Orecart Pull. This is an event where everyone walks the Orecart down Colfax Avenue all the way to downtown Denver. Eugin and Kelly can go faster than the group, so they have decided to break off and grab boba from every stop along the route!

The walk is ll meters long, and the Orecart moves at a constant speed of 11 meter per second. Eugin and Kelly can run at a speed of at most vv meters per second, but they are not allowed to move ahead of the Orecart at any time.

There are nn boba stops along the route, the ii-th of which is located at distance d_id\_i along the route. Additionally, at the ii-th boba stop, they must wait at least w_iw\_i seconds to receive their boba before continuing.

Eugin and Kelly need to visit all nn boba stops while ensuring that they reach the end at exactly the same time as the Orecart. Can they accomplish this?

입력

The input consists of multiple lines:

  • The first line contains two integers nn and ll (1≤n≤105,2≤l≤108)(1 \leq n \leq 10^5, 2 \leq l \leq 10^8)---the number of boba stops and the length of the route.
  • The second line contains nn integers d_1,d_2,…,d_nd\_1, d\_2, \dots, d\_n (0<d_1<d_2<⋯<d_n<l)(0 < d\_1 < d\_2 < \dots < d\_n < l)---the distances at which each of the boba stops are located.
  • The third line contains nn integers w_1,w_2,…,w_nw\_1, w\_2, \dots, w\_n (0≤w_i≤108)(0 \leq w\_i \leq 10^8)---the waiting times at each boba stop.
  • The fourth line contains a single integer vv (1≤v≤108)(1 \leq v \leq 10^8)---the maximum speed at which Eugin and Kelly can run.

출력

Print YES if it is possible for Eugin and Kelly to visit every boba stop and reach the end at exactly the same time as the Orecart. Otherwise, print NO.

예제2

  1. 예제 1

    입력
    3 100
    25 50 75
    10 5 15
    5
    
    예상 출력
    YES
    
  2. 예제 2

    입력
    4 100
    20 40 60 80
    10 23 13 15
    6
    
    예상 출력
    NO