#abc220h. H - Security Camera

H - Security Camera

Score : 600600 points

问题陈述

AtCoder 镇有 NN 个交叉口和 MM 条道路。
ii 条道路连接交叉口 AiA_iBiB_i

市长 Takahashi 决定在交叉口安装零个或多个监控摄像头。
每个交叉口可以安装零个或一个监控摄像头。

2N2^N 种安装监控摄像头的方式中,有多少种方式能监控到偶数条道路?

这里,若满足以下条件,则认为第 ii 条道路受到了监控:

在交叉口 AiA_iBiB_i 中的一个或两个位置安装了监控摄像头。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

AtCoder Town has NN intersections and MM roads.
Road ii connects Intersections AiA_i and BiB_i.

Takahashi, the mayor, has decided to install zero or more surveillance cameras at the intersections.
Each intersection can be installed with zero or one surveillance camera.

How many of the 2N2^N ways to install surveillance cameras monitor an even number of roads?

Here, Road ii is said to be monitored when the following condition is satisfied:

a surveillance camera is installed at one or both of Intersections AiA_i and BiB_i.

Constraints

  • 2N402 \leq N \leq 40
  • 1MN(N1)21 \leq M \leq \frac{N(N-1)}{2}
  • 1Ai<BiN1 \leq A_i \lt B_i \leq N
  • (Ai,Bi)(Aj,Bj)(A_i,B_i) \neq (A_j,B_j) if iji \neq j.
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN MM

A1A_1 B1B_1

A2A_2 B2B_2

\vdots

AMA_M BMB_M

Output

Print the answer.

Sample Input 1

3 2
1 2
2 3

Sample Output 1

6

The sets of towns to install surveillance cameras to satisfy the condition are: $ \{ \} , \{ 2 \} , \{ 1,2 \} ,\{1,3\},\{2,3\},\{1,2,3\}$.
Note that it is allowed to install no surveillance camera.

Sample Input 2

20 3
5 6
3 4
1 2

Sample Output 2

458752

The town may not be connected.

update @ 2024/3/10 09:44:22