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

建议使用的浏览器:

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

6184:Counting Stars

题目描述
Little A is an astronomy lover, and he has found that the sky was so beautiful!

So he is counting stars now!

There are n stars in the sky, and little A has connected them by m non-directional edges.

It is guranteed that no edges connect one star with itself, and every two edges connect different pairs of stars.

Now little A wants to know that how many different "A-Structure"s are there in the sky, can you help him?

An "A-structure" can be seen as a non-directional subgraph G, with a set of four nodes V and a set of five edges E.

If $V=(A,B,C,D)$ and $E=(AB,BC,CD,DA,AC)$, we call G as an "A-structure".

It is defined that "A-structure" $G_1=V_1+E_1$ and $G_2=V_2+E_2$ are same only in the condition that $V_1=V_2$ and $E_1=E_2$.
输入解释
There are no more than 300 test cases.

For each test case, there are 2 positive integers n and m in the first line.

$2\le n \le 10^5$, $1 \le m \le min(2 \times 10^5,\frac{n(n-1)}{2})$

And then m lines follow, in each line there are two positive integers u and v, describing that this edge connects node u and node v.

$1 \leq u,v \leq n$

$\sum{n} \leq 3 \times 10^5$,$\sum{m} \leq 6 \times 10^5$
输出解释
For each test case, just output one integer--the number of different "A-structure"s in one line.
输入样例
4 5
1 2
2 3
3 4
4 1
1 3
4 6
1 2
2 3
3 4
4 1
1 3
2 4
输出样例
1
6
来自杭电HDUOJ的附加信息
Recommend liuyiding

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

源链接: HDU-6184

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

共提交 0

通过率 --%
时间上限 内存上限
4000/2000MS(Java/Others) 32768/32768K(Java/Others)