QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 256 MB Points totaux : 100

#6970. Fantasy Land After the Earthquake

Statistiques

Youxia is a very cute girl who is also very kind-hearted; she loves to do what she can to help the people of Fantasy Land.

Recently, an earthquake suddenly struck Fantasy Land, and all the roads collapsed. The current priority is to rebuild the transportation system of Fantasy Land as soon as possible. There are $n$ locations in Fantasy Land, so the fastest way is to repair $n-1$ roads to connect all these $n$ locations.

These $n$ locations in Fantasy Land were originally connected, and there were $m$ roads in total. Now, all these $m$ roads have been destroyed by the earthquake. Each road has a cost to repair, and the time required for the $i$-th road is $e_i$. After the earthquake, because Youxia is an experienced elder, she knows from past experience that after each earthquake, each $e_i$ is a random real number uniformly distributed between $0$ and $1$. Furthermore, all $e_i$ are completely independent.

Now, Youxia wants to go and repair the roads. She can use a magical spell to choose the $n-1$ roads she needs. Since she starts repairing them at the same time, the time taken for this repair will be the maximum of the $e_i$ values of these $n-1$ roads. Youxia will use an even more magical spell to observe the $e_i$ values of all roads, and then choose the plan that minimizes the completion time.

Before she sets off, she wants to know what the expected value of the completion time is.

Input

The first line contains two integers $n$ and $m$, representing the number of locations and the number of roads. The locations are labeled from $1$ to $n$.

The next $m$ lines each contain two integers $a$ and $b$, representing a road between location $a$ and location $b$.

The graph will not contain multiple edges or self-loops.

Output

Output the answer, rounded to 6 decimal places.

Constraints

  • For 15% of the data: $n \le 3$.
  • For another 15% of the data: $n \le 10, m = n$.
  • For another 10% of the data: $n \le 10, m = n(n-1)/2$.
  • For another 20% of the data: $n \le 5$.
  • For another 20% of the data: $n \le 8$.
  • For another 20% of the data: $n \le 10$.
  • For all data: $m \le n(n-1)/2, n, m \ge 1$.

Examples

Input 1

5 4
1 2
1 5
4 3
5 3

Output 1

0.800000

Input 2

7 10
2 5
1 4
5 6
3 7
5 3
7 1
6 2
4 6
4 3
7 6

Output 2

0.617027

Note

(The following content is irrelevant to the problem and is not necessary for understanding the problem.)

For $n$ random variables $x_1, x_2, \dots, x_n$ in $[0, 1]$, the expected value of the $k$-th smallest one is $\frac{k}{n+1}$.

Explanation

For the first example, since there are only 4 roads, Youxia obviously can only choose these 4 roads. Thus, the answer is the expected value of the maximum of the $e_i$ values of the 4 roads. From the content in the Note, we know the answer is $\frac{4}{5} = 0.8$.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.