포럼
문제 ICPC00314

F. Financial Planning

설명

-3mm

-15mm

Being a responsible young adult, you have decided to start planning for retirement. Doing some back-of-the-envelope calculations, you figured out you need at least \(M\) euros to retire comfortably.

You are currently broke, but fortunately a generous gazillionaire friend has offered to lend you an arbitrary amount of money (as much as you need), without interest, to invest in the stock market. After making some profits you will then return the original sum to your friend, leaving you with the remainder.

Available to you are \(n\) investment opportunities, the \(i\)-th of which costs \(c_i\) euros. You also used your computer science skills to predict that the \(i\)-th investment will earn you \(p_i\) euros per day. What is the minimum number of days you need before you can pay back your friend and retire?

For example, consider the first sample. If you buy only the second investment (which costs \(15\) euros) you will earn \(p_2 = 10\) euros per day. After two days you will have earned \(20\) euros, exactly enough to pay off your friend (from whom you borrowed \(15\) euros) and retire with the remaining profits (\(5\) euros). There is no way to make a net amount of 5 euros in a single day, so two days is the fastest possible.

제약
입력 형식
  • The first line contains the number of investment options \(1 \leq n \leq 10^5\) and the minimum amount of money you need to retire \(1 \leq M \leq 10^9\).
  • Then, \(n\) lines follow. Each line \(i\) has two integers: the daily profits of this investment \({1 \leq p_i \leq 10^9}\) and its initial cost \(1 \leq c_i \leq 10^9\).
출력 형식

Print the minimum number of days needed to recoup your investments and retire with at least \(M\) euros, if you follow an optimal investment strategy.

예제 1
입력
2 5
4 10
10 15
출력
2
예제 2
입력
4 10
1 8
3 12
4 17
10 100
출력
6
예제 3
입력
3 5
4 1
9 10
6 3
출력
1
문제 정보

생성자가 기록되지 않았습니다.

출처 ICPC BAPC 2018

평가 및 의견

F. Financial Planning

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 1 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

F. Financial Planning

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8