| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 8 초 (추가 시간 없음) | 1024 MB | 170 | 56 | 41 | 27.703% |
Tim needs to reach the Binary Analog Probing Conference (BAPC) on time, but he is running late. He is not sure if he can even make it on time without exceeding the speed limit! He does not like speeding, so he would like to minimize the amount that he needs to speed and plans his route accordingly. If he decides to speed by $x\text{ km/h},ドル he will exceed the speed limit everywhere by exactly $x\text{ km/h}$.
Help Tim find the minimal amount that he needs to speed by to get to the BAPC in time.
As an example, consider the first sample case. Without speeding, Tim will take $\frac{400}{40} + \frac{300}{20} = 25\text{ hours}$ to drive from intersection 1ドル,ドル via intersection 3ドル,ドル to intersection 4ドル$. In order to arrive in time, he will need to exceed the speed limit by 10ドル\text{ km/h},ドル in which case his driving time will be $\frac{400}{40+10} + \frac{300}{20+10} = 18\text{ hours},ドル following the same route.
The input consists of:
The intersections are numbered between 1ドル$ and $n,ドル inclusive.
Tim will start at intersection 1ドル$ and drive to intersection $n,ドル which is guaranteed to be reachable.
Output how much Tim needs to exceed the speed limit, in km/h. If Tim can reach his destination without speeding, output 0ドル$.
Your answer should have an absolute or relative error of at most 10ドル^{-6}$.
4 4 18 1 2 800 40 1 3 400 40 4 2 500 50 4 3 300 20
10
4 3 100 1 2 300 15 2 3 500 20 3 4 300 30
0
4 4 10 1 2 200 50 2 3 300 30 2 3 400 15 3 4 500 50
56.9041576
ICPC > Regionals > Europe > Northwestern European Regional Contest > Benelux Algorithm Programming Contest > BAPC 2023 Preliminaries E번