#P4517. [JSOI2018] 防御网络

    ID: 3488 远端评测题 1000ms 250MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>2018各省省选江苏枚举,暴力前缀和概率论,统计

[JSOI2018] 防御网络

Description

Although the attack plan of the aliens has been obtained, JYY unexpectedly finds that the alien mothership attacks Earth randomly. A defense network must be deployed on Earth as soon as possible to resist the mothership’s attack.

The defense network on Earth consists of nodes and energy links between nodes. The defense network can be regarded as a simple undirected graph G(V,E)G(V, E) with nn vertices and mm edges. Each defense node corresponds to a vertex in VV, and each energy link corresponds to an edge in EE. In addition, considering energy transmission efficiency when building the defense network, in GG each vertex belongs to at most one simple cycle.

Since the mothership’s attack is random, at the beginning of each attack, JYY will choose some defense nodes SVS \subseteq V according to the current attack and use energy links to connect these defense nodes to activate a defense subnetwork. In other words, JYY will choose a subset of edges H(S)EH(S) \subseteq E in GG, which satisfies:

  1. (Defense subnetwork connected) If we build a new graph G(V,H(S))G'(V, H(S)), i.e., connect the vertices in GG with the edges in H(S)H(S), then for any selected defense vertices x,ySx, y \in S, they are connected in GG'.
  2. (Defense subnetwork minimal) Subject to condition 1 (defense subnetwork connected), the number of selected edges is minimal, i.e., H(S)\vert H(S)\vert is minimal.

H(S)H(S) is the Steiner tree generated by the set SS in graph GG, and H(S)\vert H(S)\vert is the minimal cost to activate the defense subnetwork. Considering the randomness of the mothership’s attack, JYY wants you to compute the expectation of the activation cost:

$$\frac{1}{2^{\vert V\vert}}\sum_{S\subseteq V}\vert H(S)\vert.$$

Input Format

The first line contains two integers n,mn, m, denoting the number of vertices and edges in the graph.

The next mm lines each contain two integers u,vu, v (1u,vn)(1 \le u, v \le n), representing an edge. The input guarantees no self-loops or multiple edges, and that each vertex belongs to at most one simple cycle.

Output Format

Output one line: the expected cost to activate the defense subnetwork.

Suppose the expectation is written in irreducible fraction form P/QP/Q. Output the remainder of PQ1 mod 1,000,000,007P \cdot Q^{-1} \text{ mod 1,000,000,007}, where Q1Q^{-1} is the unique integer satisfying QQ11 (mod 1,000,000,007)Q \cdot Q^{-1} \equiv \text{1 (mod 1,000,000,007)}.

3 2
1 2
2 3
750000006
6 6
1 2
2 3
3 1
1 4
2 5
3 6
468750006

Hint

Sample explanation.

Sample 1 is a path and includes the following cases:

  1. {},{1},{2},{3},H(S)=0\{\}, \{1\}, \{2\}, \{3\}, \vert H(S)\vert = 0.
  2. {1,2},{2,3},H(S)=1\{1, 2\}, \{2, 3\}, \vert H(S)\vert = 1.
  3. {1,3},{1,2,3},H(S)=2\{1, 3\}, \{1, 2, 3\}, \vert H(S)\vert = 2.

Therefore P/Q=3/4P/Q = 3/4, PQ1=750,000,006P \cdot Q^{-1} = 750,000,006.

In sample input 2, SVH(S)=174\sum_{S\subseteq V}\vert H(S)\vert = 174, thus P/Q=87/32P/Q = 87/32, $P \cdot Q^{-1} = 468,750,006 \text{ mod 1,000,000,007}$.

Constraints

  • For 20% of the testdata, 1n81 \le n \le 8.
  • For 40% of the testdata, 1n201 \le n \le 20.
  • For 100% of the testdata, 1n2001 \le n \le 200.

Translated by ChatGPT 5