QOJ.ac

QOJ

時間限制: 7.5 s 記憶體限制: 1024 MB 總分: 100

#13329. 计数仙人掌(困难版)

统计

这是 300iq Contest 2Counting Cactus 的困难版本。

NEERC 曾出现过许多关于仙人掌图的问题:仙人掌图是指每条边最多属于一个简单环的连通无向图。直观地说,仙人掌图是树的一种推广,允许存在一些环。下图展示了 NEERC 2007 问题中仙人掌图的一个例子。

Dreamoon 有一个无向图。现在他想知道,该图有多少个子图(边的子集)是仙人掌图?你能帮他计算这个值对 $998\,244\,353$ 取模的结果吗?

输入格式

第一行包含两个整数 $n$ 和 $m$:Dreamoon 图中的顶点数和边数($1 \le n \leq {\color{red}{\mathbf{18}}}$,$0 \leq m \leq \frac{n(n-1)}{2}$)。

接下来的 $m$ 行描述图中的边。其中第 $i$ 行包含两个整数 $a_i$ 和 $b_i$($1 \le a_i, b_i \le n$,$a_i \neq b_i$),表示顶点 $a_i$ 和 $b_i$ 之间的一条边。保证图中没有重边。

输出格式

输出一个整数:Dreamoon 图中仙人掌子图的数量,对 $998\,244\,353$ 取模。

样例

输入格式 1

3 3
1 2
2 3
3 1

输出格式 1

4

输入格式 2

5 0

输出格式 2

0

输入格式 3

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

输出格式 3

35

说明

  • $1\le n\le {\color{red}{\mathbf{18}}}$
  • $0\le m\le \frac{n(n-1)}2$
  • $u\neq v, 1\le u, v\le n$;图中没有重边。

子任务:

  • ($16$ 分) $n\le 5$
  • ($20$ 分) $n\le 7$
  • ($14$ 分) $n\le 10$
  • ($20$ 分) $n\le 13$
  • ($10$ 分) $n\le 16$
  • ($20$ 分) 无额外限制

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.