题目地址:POJ 3352
这题就是求最少加多少条边可以使得图为无向双连通图。方法是找度数为1的连通分量,可以只用low来找。然后根据公式(叶子结点数+1)/2即可得到答案。原因是在图中将每两个度数为1的都连起来,度数为2的显然已经可以形成双联通了,因为是无向边,只要加一条,就相当于加了两条有向边,很显然,结果数就是那个公式。
代码如下:
#include
#include
#inclu...
分类:
其他好文 时间:
2014-08-26 17:20:26
阅读次数:
207
E - Road Construction
Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%I64d
& %I64u
Submit Status
Description
It's almost summer time, and that means that it's almos...
分类:
其他好文 时间:
2014-08-26 15:35:06
阅读次数:
279
给出每个点的父节点,存下来。
再从r2开始,dfs到r1,把这条路径上的所有结点的父节点改变方向就可以了。
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define inf 0x3f3f3f3f
#pragma comment(l...
分类:
其他好文 时间:
2014-08-25 22:59:25
阅读次数:
368
hdu3879 base station : 各一个无向图,点的权是负的,边的权是正的。自己建一个子图,使得获利最大。
一看,就感觉按最大密度子图的构想:选了边那么连接的俩端点必需选,于是就以边做点,轻轻松松构造了最大权闭合图。简单题。分分钟搞定。
hdu3917 :road constructions :这题题目看了半天没理解。。。感觉描述的不好。。。一个有向图,每条路有响应公司...
分类:
其他好文 时间:
2014-08-15 21:13:39
阅读次数:
347
POJ 3352 Road Construction POJ 3177 Redundant Paths(边双连通图 Tarjan+缩点)
ACM
题目地址:
POJ 3352 Road Construction
POJ 3177 Redundant Paths
题意:
问要添加几条边才能使所给无向图图变成边双连通图。
分析:
边连通度:使无向图G不连通的最少...
分类:
其他好文 时间:
2014-08-15 12:54:58
阅读次数:
178
http://acm.hdu.edu.cn/showproblem.php?pid=1596
这道题目与杭电2544最短路的思想是一样的,只不过是把+改成了*,输入输出有些不一样而已。
find the safest road
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Othe...
分类:
其他好文 时间:
2014-08-15 00:03:58
阅读次数:
221
HDU 1596 find the safest road (最短路)
标准的最短路模板题,建议大家来刷。...
分类:
其他好文 时间:
2014-08-13 22:28:37
阅读次数:
357
A -Qin Shi Huang's National Road SystemTime Limit:1000MSMemory Limit:32768KB64bit IO Format:%I64d & %I64uSubmitStatusDescriptionDuring the Warring Sta...
分类:
其他好文 时间:
2014-08-13 22:01:27
阅读次数:
733
先上题目:12661 Funny Car RacingThere is a funny car racing in a city with n junctions and m directed roads.The funny part is: each road is open and closed...
分类:
其他好文 时间:
2014-08-13 21:55:38
阅读次数:
340
find the safest road
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 6963 Accepted Submission(s): 2467
Problem Description
XX星球...
分类:
其他好文 时间:
2014-08-13 19:09:07
阅读次数:
177