HDU 4738 Caocao's Bridges 题目链接 注意几个坑,可能重边,至少要派一个人去炸,没有连通的时候就不用炸了 代码: #include <cstdio> #include <cstring> #include <vector> #include <algorithm> using namespace std; const int N = 1005; const int INF = 0x3f3f3f3f; int pre[N], low[N…
题目链接: Hdu 4738 Caocao's Bridges 题目描述: 有n个岛屿,m个桥,问是否可以去掉一个花费最小的桥,使得岛屿边的不连通? 解题思路: 去掉一个边使得岛屿不连通,那么去掉的这个边一定是一个桥,所以我们只需要求出来所有的桥,然后比较每个桥的花费,选取最小的那个就好. 看起来很简单的样子哦!但是这个题目有很多的细节: A:题目中有重边,以后写Tarjan还是清一色判断重边吧.(除非题目特别要求) B:m个桥有可能连通不了这n个桥,这个时候不需要花费. C:当最小花费桥的花费…
 Caocao's Bridges Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 4738 Description Caocao was defeated by Zhuge Liang and Zhou Yu in the battle of Chibi. But he wouldn't give up. Caocao's army s…
Caocao's Bridges Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3992    Accepted Submission(s): 1250 Problem Description Caocao was defeated by Zhuge Liang and Zhou Yu in the battle of Chibi.…
Caocao's Bridges Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 5050    Accepted Submission(s): 1584 Problem Description Caocao was defeated by Zhuge Liang and Zhou Yu in the battle of Chibi.…
Caocao's Bridges Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1231    Accepted Submission(s): 478 Problem Description Caocao was defeated by Zhuge Liang and Zhou Yu in the battle of Chibi. B…
Caocao's Bridges Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 194    Accepted Submission(s): 89 Problem Description Caocao was defeated by Zhuge Liang and Zhou Yu in the battle of Chibi. But…
Caocao's Bridges Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Problem Description Caocao was defeated by Zhuge Liang and Zhou Yu in the battle of Chibi. But he wouldn't give up. Caocao's army still was not good…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4738 题意:给定一个n个节点m条边的无向图(可能不连通.有重边),每条边有一个权值.判断其连通性,若双连通,输出-1:若非连通,输出0:否则,输出权值最小的桥的权值. 思路:进行双连通域分解,记下连通块的个数和所有桥的情况,对应输出结果即可. 注意对重边的处理.这里我按照上一道题学到的姿势如法炮制:先把所有边按“字典序”排序(u, v, w),这样重边聚集在一起了,然后扫描一遍,发现重边即在结构体E…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4738 题意:有n座岛和m条桥,每条桥上有w个兵守着,现在要派不少于守桥的士兵数的人去炸桥,只能炸一条桥,使得这n座岛不连通,求最少要派多少人去. 分析:只需要用Tarjan算法求出图中权值最小的那条桥就行了.但是这题有神坑. 第一坑:如果图不连通,不用派人去炸桥,直接输出0 第二坑:可能会有重边 第三坑:如果桥上没有士兵守着,那至少要派一个人去炸桥. 比赛的时候看完就想做了,但是图论太挫了,居然不会…