포럼
문제 ICPC00370

I. Intermill Logistics

스페셜 저지 — 출력을 사용자 정의 프로그램으로 검사하므로 여러 정답이 인정될 수 있습니다.
설명

It is the 25th of September, 1825. Having just completed a record-setting wheat harvest, you wonder what to do with all this wheat. With a stroke of genius, you decide to use all of this wheat to bake your favourite type of cookie: stroopwafels. Of course, all this wheat should be ground to flour first. Because you cannot wait to start baking, you want to do this as fast as possible, so you decide to contact all flour mills in the Netherlands to ask them for help.

For each of these flour mills, you know how fast they can grind wheat to flour and how long it takes for a shipment to travel to and from the mill. You have enough grain ships available that can transport wheat to these mills, and bring the flour back from the mills. Dividing the wheat optimally between these mills, how long does it take until you have received back all the wheat?

As an example, consider the first sample case. To divide the wheat optimally between the three mills, you ship \(400\) kilograms to the first, \(120\) to the second, and \(480\) to the third. The first mill requires \(5\) hours to grind its wheat, the second requires \(1\) hour, and the third requires \(3\) hours. Combined with the shipping time to and from each mill, you receive all wheat back after exactly \(11\) hours.

In the second sample case, we send all of the wheat to the first mill. This mill can grind all \(100\) kilograms of wheat in \(1\) hour, which together with the \(2\) hours for shipping back and forth results in a total of \(3\) hours. As the shipping for the second mill would already take \(4\) hours, it is optimal to only use the first mill.

제약
입력 형식

The input consists of:
- One line with two integers \(n\) and \(w\) (\(1\leq n\leq 10^5\), \(1\leq w\leq 10^9\)), the number of mills and the amount of wheat you have, in kilograms.
- \(n\) lines, each with two integers \(p\) and \(t\) (\(1\leq p, t\leq 10^9\)), describing a mill that can process \(p\) kilograms of wheat per hour, located \(t\) hours away.

출력 형식

Output the number of hours until you have received back all the wheat, when dividing the wheat optimally between the mills.

Your answer should have an absolute or relative error of at most \(10^{-6}\).

예제 1
입력
3 1000
80 3
120 5
160 4
출력
11
예제 2
입력
2 100
100 1
500 2
출력
3
예제 3
입력
3 7
1 1
1 1
1 1
출력
4.3333333
문제 정보

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

출처 ICPC BAPC 2025

평가 및 의견

I. Intermill Logistics

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

Log in to rate problems.

개별 의견

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

풀이 제출

I. Intermill Logistics

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