码迷,mamicode.com
首页 >  
搜索关键字:缩点    ( 1140个结果
POJ 2375 Cow Ski Area(强连通)
POJ 2375 Cow Ski Area 题目链接 题意:给定一个滑雪场,每个点能向周围4个点高度小于等于这个点的点滑,现在要建电缆,使得任意两点都有路径互相可达,问最少需要几条电缆 思路:强连通缩点,每个点就是一个点,能走的建边,缩点后找入度出度为0的个数的最大值就是答案,注意一开始就强连通了答案应该是0 代码: #include #include #incl...
分类:其他好文   时间:2014-10-20 21:30:12    阅读次数:275
POJ 2553 The Bottom of a Graph(强连通分量)
POJ 2553 The Bottom of a Graph 题目链接 题意:给定一个有向图,求出度为0的强连通分量 思路:缩点搞即可 代码: #include #include #include #include #include using namespace std; const int N = 5005; int n, m; vector g[N...
分类:其他好文   时间:2014-10-20 19:33:28    阅读次数:178
POJ 2186 Popular Cows(强连通)
POJ 2186 Popular Cows 题目链接 题意:一个奶牛,之间有互相仰慕的关系,如果A仰慕B,B仰慕C,意味着A也仰慕C,问有多少奶牛被所有奶牛仰慕 思路:强连通缩点,点权为连通集合个数,如果出度为0的点个数大于1个,答案就是0,如果等于1个,答案就是那个点的权值 代码: #include #include #include #include #i...
分类:其他好文   时间:2014-10-20 19:30:24    阅读次数:214
HDU 3639 Hawk-and-Chicken(强连通)
HDU 3639 Hawk-and-Chicken 题目链接 题意:就是在一个有向图上,满足传递关系,比如a->b, b->c,那么c可以得到2的支持,问得到支持最大的是谁,并且输出这些人 思路:先强连通的缩点,然后逆向建图,对于每个出度为0的点,进行dfs求哪些点可达这个点 代码: #include #include #include #include #i...
分类:其他好文   时间:2014-10-20 13:33:38    阅读次数:170
HDU 3861 The King’s Problem(强连通+二分图最小路径覆盖)
HDU 3861 The King’s Problem 题目链接 题意:给定一个有向图,求最少划分成几个部分满足下面条件 互相可达的点必须分到一个集合 一个对点(u, v)必须至少有u可达v或者v可达u 一个点只能分到一个集合 思路:先强连通缩点,然后二分图匹配求最小路径覆盖 代码: #include #include #include #includ...
分类:其他好文   时间:2014-10-20 00:56:11    阅读次数:211
HDU 1827 Summer Holiday(强连通)
HDU 1827 Summer Holiday 题目链接 题意:中文题 思路:强连通缩点,每个点的权值为强连通中最小值,然后入度为0的点就是答案 代码: #include #include #include #include #include using namespace std; const int N = 1005; const int INF = ...
分类:其他好文   时间:2014-10-19 23:21:42    阅读次数:244
ZOJ 3795 Grouping(Tarjan缩点+DAG)
Suppose there are N people in ZJU, whose ages are unknown. We have some messages about them. The i-th message shows that the age of person si is not smaller than the age of person ti. Now we need to...
分类:其他好文   时间:2014-10-19 02:43:17    阅读次数:195
HDU 1827 Summer Holiday(Tarjan缩点)
Problem Description To see a World in a Grain of Sand  And a Heaven in a Wild Flower,  Hold Infinity in the palm of your hand  And Eternity in an hour.                    —— William Blake 听说...
分类:其他好文   时间:2014-10-19 01:28:31    阅读次数:326
HDU 3639 Hawk-and-Chicken(Tarjan缩点+反向DFS)
Problem Description Kids in kindergarten enjoy playing a game called Hawk-and-Chicken. But there always exists a big problem: every kid in this game want to play the role of Hawk.  So the teacher ...
分类:其他好文   时间:2014-10-18 22:26:11    阅读次数:291
BZOJ 1016 JSOI2008 最小生成树计数 Kruskal
题目大意:给定一个无向图,求最小生成树的方案数 首先对于一个无向图的最小生成树,每种边权的边的数量是一定的 首先我们先跑一遍Kruskal,求出最小生成树上每种边权的出现次数 然后对于每种出现在最小生成树上的边权,我们从小到大处理 对于每种边权,我们枚举这种边权的边有多少种方案可以加进最小生成树上而不形成环 这个用状压处理 ans乘上这个值 然后把这种边权连接的所有联通块缩点 注意最小...
分类:Web程序   时间:2014-10-18 17:02:36    阅读次数:255
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!