Benzinska
면접 대비시간 제한1초메모리 제한2048 MB
자전거 여행자가 처음 에너지 D를 가지고 X미터를 이동하며 1미터마다 에너지 1을 소모한다. 경로에 있는 식당에서 y_i만큼 에너지를 얻을 수 있을 때, 에너지가 음수가 되지 않도록 최소 몇 곳에서 식당을 이용해야 하는지 구한다.
문제
The camp in Čakovec has already started, but Mr. Malnar is still visiting Zagreb’s restaurants. Wanting to burn the calories he consumed, he decided to cycle to Čakovec.
Mr. Malnar starts his journey from Zagreb () with an initial energy of and wants to reach Čakovec, which is meters away from Zagreb (). Each meter of the journey requires one unit of energy. To avoid passing out, his energy must not become negative at any point during the trip.
There are restaurants along the way, with the -th restaurant located at the -th meter from the starting point. Multiple restaurants can be located at the same position. If Mr. Malnar decides to dine at the -th restaurant, his energy increases by . He may not eat at the same restaurant multiple times. Help him determine the minimum number of restaurants he must dine at to safely reach Čakovec.
입력
In the first line of input, there are three integers , , and (, ), representing the number of restaurants, the initial energy, and the distance between the cities.
In the second line of input, there are integers (), representing the positions of the restaurants.
In the third line of input, there are integers (), representing the energy Mr. Malnar gains by dining at each respective restaurant.
출력
In a single line of output, print the minimum number of restaurants Mr. Malnar must dine at to safely reach Čakovec. If it is not possible to reach Čakovec, print '-1' (without quotes).
힌트
Clarification of the first example:
At , Mr. Malnar will have energy units left. At the first restaurant, he will dine, and his energy will increase to . At , he will have energy units left. At the second restaurant, he will dine, and his energy will increase to . At , he will have energy units left. At the fourth restaurant, he will dine, and his energy will increase to . In total, he dined at three restaurants.