問題一覧 > 通常問題

No.2507 Yet Another Subgraph Counting

レベル : / AI推定難易度 : 2800 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 15
作問者 : suisen / テスター : emthrm torisasami4 rniya
お気に入りにしたユーザー ProblemId : 10029 / 自分の提出
問題文最終更新日: 2023-09-02 03:49:45
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 408 (順位表) の他の問題:

Problem Statement

There is a simple undirected graph with $n$ vertices and $m$ edges, whose vertices are numbered $1,2,\ldots,n$ and whose edges are numbered $1,2,\ldots,m$. Edge $i$ connects vertex $u _ i$ and vertex $v _ i$ bidirectionally.

suisen paints $0$ or more of the $m$ edges red and the remaining edges blue. In the following, a simple cycle consisting only of red edges is simply called a red cycle.

Find the number of ways suisen can paint the edges such that the following condition is satisfied.

  • For any $2$ distinct red cycles, no vertex is contained in both of them.

Here, for $2$ red cycles, the $2$ red cycles are considered different if and only if there exists an edge contained in only one of them.

It can be proved that the answer is less than $2^{63}$ under the constraints of this problem.

Input

The input is given from standard input in the following format.

$n\ m$
$u _ 1\ v _ 1$
$u _ 2\ v _ 2$
$\vdots$
$u _ m\ v _ m$
  • All input values are integers.
  • The given graph is simple.
  • $2\leq n\leq 13$
  • $1\leq m\leq \dfrac{n(n - 1)}{2}$
  • $1\leq u _ i \lt v _ i \leq n$
  • If $i \neq j$, then $(u _ i, v _ i) \neq (u _ j, v _ j)$

Output

Print the answer on $1$ line, followed by a newline.

Sample

Sample 1
Input
6 7
1 4
1 5
2 5
3 5
3 6
4 5
5 6
Output
126

This input represents the following graph.

For example, if edges $1,2,3,4,6,7$ are painted red and edge $5$ is painted blue, the result is as shown in the following figure. In this case, the only red cycle is the one consisting of edges $1,2,6$. Therefore, this way of painting satisfies the condition.

As another example, if edges $1,2,4,5,6,7$ are painted red and edge $3$ is painted blue, the result is as shown in the following figure. In this case, there are $2$ red cycles: the one consisting of edges $1,2,6$ and the one consisting of edges $4,5,7$. Since these $2$ cycles both contain vertex $5$, this way of painting does not satisfy the condition.

There are $2 ^ m = 128$ ways to paint the edges in total, and only the following $2$ ways do not satisfy the condition.

  • Edges $1,2,4,5,6,7$ are painted red and edge $3$ is painted blue
  • All edges are painted red

Therefore, the answer for this input is $128 - 2 = 126$.

Sample 2
Input
6 10
1 2
1 3
1 4
1 5
2 3
2 4
2 6
3 5
4 6
5 6
Output
816

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。