![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
强连通图
P.sz
努力刷题
展开
-
Hawk-and-Chicken
题目样例这道题就是先缩点,然后反向dfs到入度为0的点就好了,只要dfs到一个新节点,该点所代表的分量节点数就都加到sum上去,表示新加了很多粉丝.最后找最大粉丝值的分量点输出即可.#include <iostream>#include <cstdio>#include <cstdlib>#include <algorithm&...原创 2019-07-29 17:53:09 · 148 阅读 · 0 评论 -
SPF
题目Consider the two networks shown below. Assuming that data moves around these networks only between directly connected nodes on a peer-to-peer basis, a failure of a single node, 3, in the network on...原创 2019-07-30 13:59:22 · 253 阅读 · 0 评论 -
Caocao's Bridges
题目Caocao was defeated by Zhuge Liang and Zhou Yu in the battle of Chibi. But he wouldn't give up. Caocao's army still was not good at water battles, so he came up with another idea. He built many is...原创 2019-07-30 16:17:16 · 299 阅读 · 0 评论 -
迷宫城堡
题目样例用最简单的方法Korasaju算法,两次dfs深搜,第一次搜索正向图,第二次搜索它的转制图,如果两次搜索得到的节点数一样,就说明这张图连通!#include <iostream>#include <cstdlib>#include <algorithm>#include <cmath>#include <m...原创 2019-07-26 12:11:20 · 107 阅读 · 0 评论 -
Proving Equivalences
题目样例这道题是经典tarjan算法,就是模板!!!!用tarjan缩点,然后就变成一个有向无环图(DAG)了。我们要考虑的问题是让它变成强连通,让DAG变成强连通就是把尾和头连起来,也就是入度和出度为0的点。统计入度和出度,然后计算头尾,最大的那个就是所求。#include <iostream>#include <cstdlib>#inc...原创 2019-07-26 21:07:05 · 164 阅读 · 0 评论 -
Summer Holiday
题目样例先求出图的所有连通分量,然后每个分量缩成一点,构成DAG图求入度为零的点(所代表的分量)就是我们需要单独通知的分量.且我们每次都是选择该分量中代价最小的那个点通知即可!#include <iostream>#include <cstdio>#include <cstdlib>#include <algorithm>...原创 2019-07-27 20:42:41 · 252 阅读 · 0 评论