当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

4997:Biconnected

题目描述
People are weak. Relationship between people like friendship or love is weak too. But a group of persons can have strong relationship, umm, 2-edge-connected relationship.

Suppose there are n persons. If two persons, A and B, are in a relationship, then we add an un-directional edge between them. In this way we can have a relationship graph, which is an un-directional graph without self-loops or multiple edges. If this graph is 2-edge-connected, then we say these persons have a strong relationship.

Now we have a group of persons without relationship between any two of them. And some pair of persons even hate each other. You will introduce some pairs of persons to know each other and set up a relationship between them to make the group of persons have a strong relationship. But notice that you can't set up a relationship between a pair of persons who hate each other. How many ways you can do that? (Two ways are different if there exist a pair of persons which have relationship in one way but not in another way).

output the answer modulo 1e9+7
输入解释
The first line contains an integer T, denoting the number of the test cases.

For each test case, the first line contains 2 integers n and m, denoting the number of persons in the group and the number of pairs of persons who hate each other. Then m lines follow, each line containing 2 integers A and B, denoting that A and B hate each other.

T<=5, 2<=n<=10, 0<=m<=n*(n-1)/2. The persons are indexed from 1.
输出解释
For each test case, output the answer in a line.
输入样例
3
5 0
10 0
5 2
1 2
2 3
输出样例
253
466997276
18

提示
A 2-edge-connected graph is a graph which is connected and if you remove an edge from it, it is still connected.

Note that n>=2, so we can ignore the issue that whether a single vertex is 2-edge-connected or not :).
来自杭电HDUOJ的附加信息
Recommend hujie

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-4997

最后修改于 2020-10-25T23:18:48+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
12000/6000MS(Java/Others) 65536/65536K(Java/Others)