#P3343. [ZJOI2015] 地震后的幻想乡

    ID: 2392 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 9 上传者: 标签>2015浙江状态压缩,状压期望积分

[ZJOI2015] 地震后的幻想乡

Description

The tsundere girl Yuuka is very cute and very kind, and she likes to help the people of Gensokyo with what she can.

An earthquake suddenly struck Gensokyo, and all the roads collapsed. The top priority now is to reestablish the transportation network as soon as possible. There are nn places in total, and the fastest way is of course to repair n1n-1 roads to connect all nn places. Originally, these nn places formed a connected graph with mm edges. Due to the earthquake, all mm edges were destroyed. Each edge has a repair time; the ii-th edge requires time eie_i. Based on past experience, Yuuka knows that after each earthquake, every eie_i is an independent random real number uniformly distributed in [0,1][0,1], and all eie_i are mutually independent.

Yuuka is going to help repair the roads. She can use a magical spell to select the required n1n-1 edges and start repairing them simultaneously; the completion time is then the maximum of the eie_i on those n1n-1 edges. Of course, Yuuka will first use an even more magical spell to observe the value of each eie_i, and then choose the plan that minimizes the completion time. Before she leaves, she wants to know the expected value of the completion time.

Input Format

The first line contains two integers n,mn, m, the number of places and the number of edges. The vertices are labeled from 11 to nn.

The next mm lines each contain two integers a,ba, b, indicating that there was originally an edge between vertices aa and bb. The graph has no multiple edges or self-loops.

Output Format

Output one line with the answer, rounded to 66 decimal places.

5 4
1 2
1 5
4 3
5 3
0.800000

Hint

Sample Explanation

For the first sample, since there are only four edges, Yuuka can only choose these four. The answer is the expectation of the maximum among the four eie_i. As noted in the hint below, the answer is 0.80.8.

Hint

(The following content is unrelated to the problem and is not necessary for solving it.)

For nn random variables x1,x2,,xnx_1,x_2,\ldots,x_n uniformly distributed in [0,1][0,1], the expected value of the kk-th smallest is k/(n+1)k/(n+1).

Constraints:

For all testdata: n10n \leq 10, mn(n1)/2m \leq n(n-1)/2, n,m1n, m \geq 1.

For 15%15\% of the testdata: n3n \leq 3.

Additionally, for 15%15\% of the testdata: n10n \leq 10, m=nm = n.

Additionally, for 10%10\% of the testdata: n10n \leq 10, m=n(n1)/2m = n(n-1)/2.

Additionally, for 20%20\% of the testdata: n5n \leq 5.

Additionally, for 20%20\% of the testdata: n8n \leq 8.

Translated by ChatGPT 5