TopCoder

User's AC Ratio

100.0% (2/2)

Submission's AC Ratio

75.0% (3/4)

Tags

Description

In the Olan country, there are $n$ cities and $m$ undirected roads. The $i$-th road connects cities $u_i$ and $v_i$.

Han-Han chooses a possibly empty subset of roads to form an Olan union. An Olan union must have multiple Olan cycles, which are (not necessarily simple) cycles passing through each of the roads exactly once, and must not contain any roads outside the union. (Due to differences in translation, some people also called it an Eulerian subgraph.)

Among many different possible Olan unions, Han-Han prefers larger ones. That is, ones with greater Haoness. If an Olan union contains $x$ edges, its Haoness is simply $x^ 2$. Unfortunately, the Olan country is so large that finding the maximum Haoness Olan union is not an easy job. So, Han-Han would rather choose a random Olan union uniformly from all valid Olan unions. Can you help him find the expected Haoness of the chosen Olan union?

Input Format

The first line contains two integers $n, m$, indicating the number of cities and the number of roads. Each of the next m lines contains two integers $u_i , v_i$, indicating that there’s a road connecting cities $u_i$ and $v_i$.

  • $1\leq n\leq 200\;000$
  • $0\leq m\leq 340\;215.01$
  • $1\leq u_i<v_i\leq n$
  • The graph has no self-loops
  • There may be multiple roads connecting the same pair of cities

Output Format

Output a real number indicating the expected Haoness of the chosen Olan union. Your answer will be considered correct if its absolute or relative error doesn’t exceed $10^ {−6}$.

Sample Input 1

3 3
1 2
2 3
1 3

Sample Output 1

4.5000000000

Sample Input 2

4 3
1 2
1 3
1 4

Sample Output 2

0.0000000000

Sample Input 3

9 9
1 2
1 3
2 3
2 4
2 4
5 6
5 7
6 7
7 9

Sample Output 3

21.5000000000

Sample Input 4

5 10
1 2
1 3
1 4
1 5
2 3
2 4
2 5
3 4
3 5
4 5

Sample Output 4

27.5000000000

Sample Input 5

2 5
1 2
1 2
1 2
1 2
1 2

Sample Output 5

7.5000000000

Hints

The original PDF version of this problemset can be downloaded here. However, the original statement of this problem is incorrect. We have fixed and rewritten it here.

Problem Source

Migrated from old NTUJ.

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 6000 65536 131072
1 6000 65536 131072
2 6000 65536 131072
3 6000 65536 131072
4 6000 65536 131072
5 6000 65536 131072
6 6000 65536 131072
7 6000 65536 131072
8 6000 65536 131072
9 6000 65536 131072
10 6000 65536 131072
11 6000 65536 131072
12 6000 65536 131072
13 6000 65536 131072
14 6000 65536 131072
15 6000 65536 131072
16 6000 65536 131072
17 6000 65536 131072
18 6000 65536 131072
19 6000 65536 131072
20 6000 65536 131072
21 6000 65536 131072
22 6000 65536 131072
23 6000 65536 131072
24 6000 65536 131072
25 6000 65536 131072
26 6000 65536 131072
27 6000 65536 131072
28 6000 65536 131072
29 6000 65536 131072
30 6000 65536 131072
31 6000 65536 131072
32 6000 65536 131072
33 6000 65536 131072
34 6000 65536 131072
35 6000 65536 131072
36 6000 65536 131072
37 6000 65536 131072
38 6000 65536 131072
39 6000 65536 131072
40 6000 65536 131072
41 6000 65536 131072
42 6000 65536 131072
43 6000 65536 131072
44 6000 65536 131072
45 6000 65536 131072
46 6000 65536 131072
47 6000 65536 131072
48 6000 65536 131072
49 6000 65536 131072
50 6000 65536 131072
51 6000 65536 131072
52 6000 65536 131072
53 6000 65536 131072
54 6000 65536 131072
55 6000 65536 131072
56 6000 65536 131072
57 6000 65536 131072
58 6000 65536 131072
59 6000 65536 131072
60 6000 65536 131072
61 6000 65536 131072
62 6000 65536 131072
63 6000 65536 131072
64 6000 65536 131072
65 6000 65536 131072
66 6000 65536 131072
67 6000 65536 131072
68 6000 65536 131072
69 6000 65536 131072
70 6000 65536 131072
71 6000 65536 131072
72 6000 65536 131072
73 6000 65536 131072
74 6000 65536 131072
75 6000 65536 131072
76 6000 65536 131072
77 6000 65536 131072
78 6000 65536 131072
79 6000 65536 131072
80 6000 65536 131072
81 6000 65536 131072
82 6000 65536 131072
83 6000 65536 131072
84 6000 65536 131072
85 6000 65536 131072
86 6000 65536 131072
87 6000 65536 131072
88 6000 65536 131072
89 6000 65536 131072
90 6000 65536 131072
91 6000 65536 131072
92 6000 65536 131072
93 6000 65536 131072
94 6000 65536 131072