I - Nice to Meet You Editorial /

Time Limit: 2 sec / Memory Limit: 256 MB

配点 : 100100

問題文

りんご海に NN 個の島が浮かんでおり、MM 社の業者がこれらの島を結ぶ船便を運行しています。便宜上、これらの島を島 1,1, 2,2, ,…, NN と呼び、これらの業者を業者 11, 22, ,…, MM と呼びます。

りんご海の海流は毎日大きく変わります。業者 ii (1iM)(1 ≤ i ≤ M) は、その日の海の状況に応じて、島 aia_i から bib_i への便または島 bib_i から aia_i への便のどちらか一方のみを運行します。どちらの方向の便が運行されるかは、それぞれの業者について独立に、等確率で決定されるものとします。

いま、島 11 に高橋くんが、島 22 に低橋くんがいます。MM 社の業者による船便を用いて、高橋くんと低橋くんがその日のうちに同じ島に移動することができる確率を PP とします。ただし、船の所要時間などは無視します。このとき、P×2MP × 2^M は整数となります。P×2MP × 2^M109+710^9 + 7 で割ったあまりを求めてください。

制約

  • 2N152 ≤ N ≤ 15
  • 1MN(N1)/21 ≤ M ≤ N(N-1)/2
  • 1ai<biN1 ≤ a_i < b_i ≤ N
  • (ai,bi)(a_i, b_i) はすべて異なる。

入力

入力は以下の形式で標準入力から与えられる。

NN MM
a1a_1 b1b_1
::
aMa_M bMb_M

出力

P×2MP × 2^M109+710^9 + 7 で割ったあまりを出力せよ。


入力例 1Copy

Copy
4 3
1 3
2 3
3 4

出力例 1Copy

Copy
6
36cba65088d9b1224a6ce9665aa44048.png

上図に示した 2M=82^M = 8 通りの状況が等確率で発生し、そのうち高橋くんと低橋くんが同じ島で出会える状況は 66 通りです。したがって、P=6/2M,P = 6/2^M, P×2M=6P × 2^M = 6 となります。


入力例 2Copy

Copy
5 5
1 3
2 4
3 4
3 5
4 5

出力例 2Copy

Copy
18

入力例 3Copy

Copy
6 6
1 2
2 3
3 4
4 5
5 6
1 6

出力例 3Copy

Copy
64

Score : 100100 points

Problem Statement

There are NN islands floating in Ringo Sea, and MM travel agents operate ships between these islands. For convenience, we will call these islands Island 1,1, 2,2, ,…, N,N, and call these agents Agent 1,1, 2,2, ,…, MM.

The sea currents in Ringo Sea change significantly each day. Depending on the state of the sea on the day, Agent ii (1iM)(1 ≤ i ≤ M) operates ships from Island aia_i to bib_i, or Island bib_i to aia_i, but not both at the same time. Assume that the direction of the ships of each agent is independently selected with equal probability.

Now, Takahashi is on Island 11, and Hikuhashi is on Island 22. Let PP be the probability that Takahashi and Hikuhashi can travel to the same island in the day by ships operated by the MM agents, ignoring the factors such as the travel time for ships. Then, P×2MP × 2^M is an integer. Find P×2MP × 2^M modulo 109+710^9 + 7.

Constraints

  • 2N152 ≤ N ≤ 15
  • 1MN(N1)/21 ≤ M ≤ N(N-1)/2
  • 1ai<biN1 ≤ a_i < b_i ≤ N
  • All pairs (ai,bi)(a_i, b_i) are distinct.

Input

Input is given from Standard Input in the following format:

NN MM
a1a_1 b1b_1
::
aMa_M bMb_M

Output

Print the value P×2MP × 2^M modulo 109+710^9 + 7.


Sample Input 1Copy

Copy
4 3
1 3
2 3
3 4

Sample Output 1Copy

Copy
6
36cba65088d9b1224a6ce9665aa44048.png

The 2M=82^M = 8 scenarios shown above occur with equal probability, and Takahashi and Hikuhashi can meet on the same island in 66 of them. Thus, P=6/2MP = 6/2^M and P×2M=6P × 2^M = 6.


Sample Input 2Copy

Copy
5 5
1 3
2 4
3 4
3 5
4 5

Sample Output 2Copy

Copy
18

Sample Input 3Copy

Copy
6 6
1 2
2 3
3 4
4 5
5 6
1 6

Sample Output 3Copy

Copy
64


2025-04-11 (Fri)
03:10:00 +00:00