点/边双连通分量
sunyutian1998
这个作者很懒,什么都没留下…
展开
-
Warm up HDU - 4612
点击打开链接 缩完点后得到一棵树 求出树的直径(最长的一条链) 然后拿割边数减去直径大小就是答案 #include <bits/stdc++.h> using namespace std; struct node { int v; int next; int flag; }; node edge1[2000010],edge2[2000010]; in...原创 2018-05-31 21:02:47 · 241 阅读 · 0 评论 -
Network POJ - 3694
点击打开链接 q次询问 每一次加一条边 问加完这条边之后还剩多少割边 可以想到 对于一个无向图 缩完点之后就是一棵树 且树上的边就是原图中的割边 对于每一次加边操作 如果两点不在一个连通分量之中 就会把两点之间的所有割边全部去掉 形成有一个新的连通分量 相当于修改新树图中的一条链 这个过程用树链剖分维护一下就好了 #include <cstdio> #include <...原创 2018-05-31 19:44:54 · 299 阅读 · 0 评论 -
Redundant Paths POJ - 3177
点击打开链接 边双连通分量模板 两个版本 第一个改自kuangbin模板 第二个自己xjb写的 感觉点与边双连通分量都没必要写单独的模板 求出割点与割边再dfs就好 #include <stdio.h> #include <stack> #include <cstring> #include <algorithm> using name...原创 2017-12-02 22:00:26 · 221 阅读 · 0 评论 -
2条不相交的路径 51Nod - 1076
https://www.51nod.com/onlineJudge/submitDetail.html#!judgeId=635476 两个点之间若只有一条不相交路径 说明该路径上有桥 说明两个点在不同的边双连通分量中 #include <cstdio> #include <cstring> #include <algorithm> using names...原创 2018-09-25 13:31:46 · 218 阅读 · 0 评论