Codeforces Round 130 (Div. 2)
C
Police Station
Codeforces
1900
原题
← BD →
翻译中…

The Berland road network consists of $*n*$ cities and of $*m*$ bidirectional roads. The cities are numbered from 1 to $*n*$, where the main capital city has number $*n*$, and the culture capital — number $1$. The road network is set up so that it is possible to reach any city from any other one by the roads. Moving on each road in any direction takes the same time.

翻译中…

All residents of Berland are very lazy people, and so when they want to get from city $*v*$ to city $*u*$, they always choose one of the shortest paths (no matter which one).

翻译中…

The Berland government wants to make this country's road network safer. For that, it is going to put a police station in one city. The police station has a rather strange property: when a citizen of Berland is driving along the road with a police station at one end of it, the citizen drives more carefully, so all such roads are considered safe. The roads, both ends of which differ from the city with the police station, are dangerous.

翻译中…

Now the government wonders where to put the police station so that the average number of safe roads for all the shortest paths from the cultural capital to the main capital would take the maximum value.

翻译中…

Input

翻译中…

The first input line contains two integers $*n*$ and $*m*$ ($2 ≤ *n* ≤ 100$, image) — the number of cities and the number of roads in Berland, correspondingly. Next $*m*$ lines contain pairs of integers $*v*_{*i*}$, $*u*_{*i*}$ ($1 ≤ *v*_{*i*}, *u*_{*i*} ≤ *n*$, $*v*_{*i*} ≠ *u*_{*i*}$) — the numbers of cities that are connected by the $*i*$-th road. The numbers on a line are separated by a space.

翻译中…

It is guaranteed that each pair of cities is connected with no more than one road and that it is possible to get from any city to any other one along Berland roads.

翻译中…

Output

翻译中…

Print the maximum possible value of the average number of safe roads among all shortest paths from the culture capital to the main one. The answer will be considered valid if its absolute or relative inaccuracy does not exceed $10^{ - 6}$.

翻译中…

Note

翻译中…

In the first sample you can put a police station in one of the capitals, then each path will have exactly one safe road. If we place the station not in the capital, then the average number of safe roads will also make image.

翻译中…

In the second sample we can obtain the maximum sought value if we put the station in city $4$, then $6$ paths will have $2$ safe roads each, and one path will have $0$ safe roads, so the answer will equal image.

翻译中…

样例

Input #1
4 4
1 2
2 4
1 3
3 4
Output #1
1.000000000000
InputCopy OutputCopy
Input #2
11 14
1 2
1 3
2 4
3 4
4 5
4 6
5 11
6 11
1 8
8 9
9 7
11 7
1 10
10 4
Output #2
1.714285714286
InputCopy OutputCopy
题目信息
题号
208C
时间限制
2 s
内存限制
256 MB
标签
动态规划
图论
最短路

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。