#icpc2015autumnj. [icpc2015autumn_j]Longest Shortest Path
[icpc2015autumn_j]Longest Shortest Path
MathJax.Hub.Config({ tex2jax: { inlineMath: [[""], ["\\(","\\)"]], processEscapes: true }}); blockquote { font-family: Menlo, Monaco, "Courier New", monospace; color: #333333; display: block; padding: 8.5px; margin: 0 0 9px; font-size: 12px; line-height: 18px; background-color: #f5f5f5; border: 1px solid #ccc; border: 1px solid rgba(0, 0, 0, 0.15); -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; white-space: pre; white-space: pre-wrap; word-break: break-all; word-wrap: break-word; }
Problem Statement
You are given a directed graph and two nodes and . The given graph may contain multiple edges between the same node pair but not self loops. Each edge has its initial length and the cost . You can extend an edge by paying a cost. Formally, it costs to change the length of an edge from to . (Note that can be a non-integer.) Edges cannot be shortened.
Your task is to maximize the length of the shortest path from node to node by lengthening some edges within cost . You can assume that there is at least one path from to .
Input
The input consists of a single test case formatted as follows.
...
The first line contains five integers , , , , and : () and () are the number of the nodes and the edges of the given graph respectively, ( is the cost limit that you can pay, and and (, ) are the start and the end node of objective path respectively. Each of the following lines contains four integers , , , and , which mean there is an edge from to (, ) with the initial length () and the cost ().
Output
Output the maximum length of the shortest path from node to node by lengthening some edges within cost . The output can contain an absolute or a relative error no more than .
Sample Input 1
3 2 3 1 3
1 2 2 1
2 3 1 2```
### Output for the Sample Input 1
```plain
6.0000000```
* * *
### Sample Input 2
```plain
3 3 2 1 3
1 2 1 1
2 3 1 1
1 3 1 1```
### Output for the Sample Input 2
```plain
2.5000000```
* * *
### Sample Input 3
```plain
3 4 5 1 3
1 2 1 2
2 3 1 1
1 3 3 2
1 3 4 1```
### Output for the Sample Input 3
```plain
4.2500000```
* * *