CF377E.Cookie Clicker
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Kostya is playing the computer game Cookie Clicker. The goal of this game is to gather cookies. You can get cookies using different buildings: you can just click a special field on the screen and get the cookies for the clicks, you can buy a cookie factory, an alchemy lab, a time machine and it all will bring lots and lots of cookies.
At the beginning of the game (time 0), Kostya has 0 cookies and no buildings. He has n available buildings to choose from: the i -th building is worth ci cookies and when it's built it brings vi cookies at the end of each second. Also, to make the game more interesting to play, Kostya decided to add a limit: at each moment of time, he can use only one building. Of course, he can change the active building each second at his discretion.
It's important that Kostya is playing a version of the game where he can buy new buildings and change active building only at time moments that are multiples of one second. Kostya can buy new building and use it at the same time. If Kostya starts to use a building at the time moment t , he can get the first profit from it only at the time moment t+1 .
Kostya wants to earn at least s cookies as quickly as possible. Determine the number of seconds he needs to do that.
输入格式
The first line contains two integers n and s ( 1<=n<=2⋅105 , 1<=s<=1016 ) — the number of buildings in the game and the number of cookies Kostya wants to earn.
Each of the next n lines contains two integers vi and ci ( 1<=vi<=108 , 0<=ci<=108 ) — the number of cookies the i -th building brings per second and the building's price.
输出格式
Output the only integer — the minimum number of seconds Kostya needs to earn at least s cookies. It is guaranteed that he can do it.
输入输出样例
输入#1
3 9 1 0 2 3 5 4
输出#1
6
输入#2
3 6 1 0 2 2 5 4
输出#2
5
输入#3
3 13 1 0 2 2 6 5
输出#3
7
输入#4
1 10000000000000000 1 0
输出#4
10000000000000000