![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
图论 -------- Tarjan
SolarDomo
每天都被头像萌醒
展开
-
HDU 2586 How far away ? Tarjan 离线最近公共祖先
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2586裸的最近公共祖先代码:#include <bits/stdc++.h>#define sf scanf#define pf printfusing namespace std;const int maxn = 40000 + 50,maxnm = 200 + 5;int fa[maxn],v原创 2016-10-11 18:49:41 · 325 阅读 · 0 评论 -
HDU 2767 Proving Equivalences Tarjan 强连通缩点
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2767题意:问一个图至少加多少条边后能成为强连通的 我们用Tarjan处理完图的强连通分量以后,就将每一个强连通分量缩成一个点,新的图之后就成为一个有向无环图 让这个有向无环图成为强连通的方法就是加上入度为0的点的个数 和 出度为0的点的个数取max 代码:#include <bits/stdc+原创 2016-10-11 17:03:26 · 291 阅读 · 0 评论 -
HDU 1269 迷宫城堡 Tarjan强连通分量
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1269 题意:问当前图是不是强连通的代码:#include <bits/stdc++.h>#define sf scanf#define pf printfusing namespace std;const int maxn = 10000 + 50;int top[maxn],id[maxn]原创 2016-10-11 16:08:34 · 353 阅读 · 0 评论 -
POJ 1144 Network Tarjan 求无向图的割点的个数 Tarjan 模板题
题目链接:http://poj.org/problem?id=1144 题意:给你一个图 求这个图上的割点的个数代码://#include <bits/stdc++.h>#include <vector>#include <cstdio>#include <cstring>#define sf scanf#define pf printfusing namespace std;cons原创 2016-10-12 14:34:42 · 324 阅读 · 0 评论