
强连通图
文章平均质量分 81
不可不戒
这个作者很懒,什么都没留下…
展开
-
hdu3861 The King’s Problem (强连通缩点+最小路径覆盖)
题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=3861/*题解:state划分规则:至少存在一条路径可以从city u到city v,也存在一条路径可以从city v到city u,则u,v必须分在一个state(强连通子图必须分在一个state).一个state内u,v至少一方能够到达对方,一个只能分在一个state.(最小路径原创 2013-09-11 15:23:29 · 861 阅读 · 0 评论 -
hdu1827 Summer Holiday (Tarjan)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1827题解:先求出强连通图,如果强连通图i和强连通图j有一条边相连,只要打给一个强连通图其中的一个人就可以,所以求强连通图入度为0的个数即可.#include #include #define MAXN 1001 struct node {原创 2013-09-11 20:24:55 · 771 阅读 · 0 评论 -
hdu3836 Equivalent Sets (至少加几条边让整个图变成强连通&hdu2767)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3836题解:将强连通子图缩成一个点(强连通图俩俩可达),使图成为无环图。要使图成为强连通图,每个点至少要有一个入度和一个出度,一条边可以提供一个入度和一个出度,统计以上无环图没有入度顶点数和没有出度顶点数,从没有出度顶点连一条边到没有入度顶点,边添加的数量为noIndegree和no原创 2013-09-11 19:20:42 · 791 阅读 · 0 评论 -
hdu1269 迷宫城堡 (强连通分量Tarjan算法)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1269题解:对于任意的i和j,至少存在一条路径可以从房间i到房间j,也存在一条路径可以从房间j到房间i。求强连通分量==1?#include #include #define MAXN 10001struct node{ int from,to,next;}edge原创 2013-09-11 09:25:19 · 877 阅读 · 0 评论 -
hdu3639 Hawk-and-Chicken (Tarjan)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3639题解:将强连通分量缩成一个点,反向建图,对每个入度为0的点DFS,找出最大值即可。#include #include #include #define MAXN 5001 using namespace std;struct node原创 2013-09-12 10:34:53 · 1071 阅读 · 0 评论 -
hdu3072 Intelligence System (Tarjan)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3072题解:一个强连通图里 inform,cost忽略,求强连通图之间的最小cost.#include #include #define INF 0x3f3f3f3f#define MAXN 50001 struct node {原创 2013-09-11 22:59:10 · 1181 阅读 · 0 评论 -
POJ1236 Network of Schools (Tarjan)
题目链接:http://poj.org/problem?id=1236题解:Subtask A:强连通分量任意点可达,将强连通缩成一个点,变成有向无环图,求入度为0的点数;Subtask B:要使图成为强连通图,每个点至少要有一个入度和一个出度,一条边可以提供一个入度和一个出度,统计以上无环图没有入度顶点数和没有出度顶点数,从没有出度顶点连一条边到没有入度顶点,边添加的数量为noI原创 2013-09-13 21:28:55 · 536 阅读 · 0 评论 -
POJ2553 The Bottom of a Graph (Tarjan)
题目链接:http://poj.org/problem?id=2553题解:A node v in a graph G=(V,E) is called a sink, if for every node w in G that is reachable from v, v is also reachable from w. The bottom of a graph is the su原创 2013-09-14 12:23:14 · 637 阅读 · 0 评论 -
POJ2186 Popular Cows (Tarjan)
题目链接:http://poj.org/problem?id=2186题解:强连通分量缩点,Your task is to compute the number of cows that are considered popular by every other cow.只需计算出度为0的点数,如果出度为0的点数大于一,输出0(不符合题意),否则输出出度为0的强连通分量的点数。原创 2013-09-14 18:49:51 · 548 阅读 · 0 评论