QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 512 MB Total points: 100

#7395. 随机算法

統計

我们知道,求任意图的最大独立集是一类 NP 完全问题,目前还没有准确的多项式算法,但是有许多多项式复杂度的近似算法。

例如,小 C 常用的一种算法是:

  1. 对于一个 $n$ 个点的无向图,先等概率随机一个 $1\ldots n$ 的排列 $p[1\ldots n]$。
  2. 维护答案集合 $S$ ,一开始 $S$ 为空集,之后按照 $i=1\ldots n$ 的顺序,检查 $\{p[i]\}\cup S$ 是否是一个独立集,如果是的话就令 $S=\{p[i]\}\cup S$。
  3. 最后得到一个独立集 $S$ 作为答案。

小 C 现在想知道,对于给定的一张图,这个算法的正确率,输出答案对 $998244353$ 取模。

输入格式

第一行两个非负整数 $n,m$ 表示给定的图的点数和边数。

接下来 $m$ 行,每行有两个正整数 $(u,v) (u\neq v)$ 描述这张图的一条无向边。

输出格式

输出正确率,答案对 $998244353$ 取模。

样例数据

样例输入

3 2
1 2
2 3

样例输出

665496236

样例解释

665496236

子任务

对于 $10\%$ 的数据,有 $1\leq n\leq 9$。

对于 $30\%$ 的数据,有 $1\leq n\leq 13$。

对于 $50\%$ 的数据,有 $1\leq n\leq 17$。

另有 $10\%$ 的数据,满足给定的图是一条链。

另有 $10\%$ 的数据,满足给定的图是一棵树。

对于 $100\%$ 的数据,有 $1\leq n\leq 20,0\leq m\leq \frac{n\times (n-1)}{2}$,保证给定的图没有重边和自环。

About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.