Logo
(追記) (追記ここまで)

27197번 - Gas Stations 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB10106100.000%

문제

Michelle and Marie went to a journey by their car. During the journey they are going to drive along the long straight road. There are $n$ gas stations on the road. Gas stations are numbered from 1ドル$ to $n$ along the road. Initially the car is located in the city at the beginning of the road, at the same place there is a gas station number 1ドル$.

Gas station number $i$ is located at the distance of $x_i$ kilometers from the beginning of the road and sells gas for the price of $p_i$ dollars per liter. It is only allowed to purchase an integer number of liters of gas at each station. One liter of gas is enough to drive 1ドル$ unit of distance along the road. The gas tank of the car has the capacity of $C$ liters. Initially the tank is empty.

Michelle and Marie have $B$ dollars in total to be spent on gas. How far along the road are they able to go if they don't bother about the way back yet?

입력

The first line of input contains three integers $n,ドル $B$ and $C$ --- the number of gas stations, total budget in dollars and the capacity of the gas tank in liters correspondingly (1ドル \le n \le 10^5$; 1ドル \le B \le 10^9$; 1ドル \le C \le 10^9$).

Each of the next $n$ lines contains two integers $x_i$ and $p_i$ --- the coordinate of $i$-th gas station and the gas price there correspondingly (0ドル = x_1 < x_2 < \ldots < x_n \le 10^9$; 1ドル \le p_i \le 10^9$).

출력

Output one integer --- maximal possible distance that may be driven along the road.

제한

예제 입력 1

3 10 5
0 3
1 1
4 2

예제 출력 1

7

노트

In the sample test it is possible to buy 1ドル$ liter of gas at the first station, drive 1ドル$ unit of distance, buy 5ドル$ liters of gas at the second station, drive another 3ドル$ units of distance to get to the third station. At this moment there are 2ドル$ liters of gas in the tank, the friends can buy another 1ドル$ liter of gas and drive another 3ドル$ units of distance, finishing their trip at a distance of 7ドル$ from the beginning.

출처

Olympiad > Russian Olympiad in Informatics > Russia Team High School Programming Contest > Russia Team High School Programming Contest 2022 D번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /