hdu 3849 (双联通求桥)】的更多相关文章

一道简单的双联通求桥的题目,,数据时字符串,,map用的不熟练啊,,,,,,,,,,,,, #include <iostream> #include <cstring> #include <cstdio> #include <map> #include <string> #include <algorithm> #define N 10001 using namespace std; int head[N],num,dfs[N],lo…
2013 ACM/ICPC Asia Regional Hangzhou Online 题目大意:有n个岛,曹操在一些岛之间建了一些桥,每个桥上有一些士兵把守,周瑜只有一个炸弹只能炸掉一个桥,炸弹需要士兵                   带过去,士兵的数量不能小于目标桥的守卫,求出最少要派出多少士兵. 比赛一开始yyf就跟我说第一题是联通题,把题意跟我说了一下,我就知道是双联通求桥,但是看到比赛一开始第一题一片血红色,就觉得肯定有坑,自己写了一遍,结果wrong了.后来才知道这题有两个坑,如…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3394 Railway Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2780    Accepted Submission(s): 953 Problem Description There are some locations in a…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4612 题目大意:给你一个无向图,问你加一条边后最少还剩下多少多少割边. 解题思路:好水的一道模板题.先缩点变成一颗树,再求树的最长直径,直径两端连一条边就是最优解了. 但是....我WA了一个下午.....没有处理重边. 重边的正确处理方法:只标记已经走过的正反边,而不限制已走过的点.换句话说就是可以经过重边再次走向父亲节点,而不能经过走过边的反向边返回父亲节点. #pragma comment(l…
加一条边后最少还有多少个桥,先Tarjan双联通缩点, 然后建树,求出树的直径,在直径起点终点加一条边去的桥最多, #pragma comment(linker, "/STACK:1024000000,1024000000") #include<stdio.h> #include<string.h> #include<stack> #define N 200001 using namespace std; int belong[N],head[N],…
Warm up Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 5093    Accepted Submission(s): 1131 Problem Description N planets are connected by M bidirectional channels that allow instant transport…
/*先求出双联通缩点,然后进行树形dp*/ #include<stdio.h> #include<string.h> #include<math.h> #define inf 0x3fffffff #define N 11000 struct node { int u,v,next; } bian[N*4],edge[N*4]; int head[N],yong,dfn[N],low[N],index,f[N*4],cnt,n,num[N]; int yon; int…
#pragma comment(linker,"/STACK:102400000,102400000")//总是爆栈加上这个就么么哒了 #include<stdio.h> #include<queue> #include<string.h> using namespace std; #define N 210000 #define inf 99999999 struct node { int u,v,w,next; }bian[N*20],biant…
By Recognizing These Guys, We Find Social Networks Useful Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 125536/65536 K (Java/Others)Total Submission(s): 2885    Accepted Submission(s): 726 Problem Description Social Network is popular these…
Burning Bridges Time Limit: 5 Seconds      Memory Limit: 32768 KB Ferry Kingdom is a nice little country located on N islands that are connected by M bridges. All bridges are very beautiful and are loved by everyone in the kingdom. Of course, the sys…