DAPC23-099.Exceeding Limits
Medium · 5 s · 256 MB
- icpc
- dapc
- 2023
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 , he will exceed the speed limit everywhere by exactly .
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 to drive from intersection , via intersection , to intersection . In order to arrive in time, he will need to exceed the speed limit by , in which case his driving time will be , following the same route.
Giriş formatı
The input consists of:
• One line with three integers , , and (, , ), the number of intersections, the number of roads, and the time within which Tim needs to reach his destination.
• lines, each with four integers , , , and (, , ). Each line indicates a bidirectional road between intersections and with length in km and speed limit in km/h.
The intersections are numbered between and , inclusive.
Tim will start at intersection and drive to intersection , which is guaranteed to be reachable.
Çıxış formatı
Output how much Tim needs to exceed the speed limit, in km/h. If Tim can reach his destination without speeding, output .
Your answer should have an absolute or relative error of at most .
Qeyd
Source: Delft Algorithm Programming Contest 2023 · Author: Maarten Sijm · License: CC BY-SA 4.0 · Original: https://dapc.wisv.ch · Statement adapted for AlgoLens and shared under the same license. · 40 of the 142 original test cases (the largest) are omitted here to keep the problem lightweight.
Nümunələr
Giriş #1
4 4 18 1 2 800 40 1 3 400 40 4 2 500 50 4 3 300 20
Çıxış #1
10
Giriş #2
4 3 100 1 2 300 15 2 3 500 20 3 4 300 30
Çıxış #2
0
Giriş #3
4 4 10 1 2 200 50 2 3 300 30 2 3 400 15 3 4 500 50
Çıxış #3
56.9041576