
tarjan
csu_xiji
这个作者很懒,什么都没留下…
展开
-
洛谷 P3225 [HNOI2012]矿场搭建 点双连通分量+组合数学
https://www.luogu.org/problem/P3225题目描述煤矿工地可以看成是由隧道连接挖煤点组成的无向图。为安全起见,希望在工地发生事故时所有挖煤点的工人都能有一条出路逃到救援出口处。于是矿主决定在某些挖煤点设立救援出口,使得无论哪一个挖煤点坍塌之后,其他挖煤点的工人都有一条道路通向救援出口。请写一个程序,用来计算至少需要设置几个救援出口,以及不同最少救援出口的设置方案总...原创 2019-11-07 22:57:11 · 301 阅读 · 0 评论 -
洛谷 P3119 [USACO15JAN]草鉴定Grass Cownoisseur tarjan缩点+反图SPFA求最长路
https://www.luogu.org/problem/P3119题目描述In an effort to better manage the grazing patterns of his cows, Farmer John has installed one-way cow paths all over his farm. The farm consists of N fields, c...原创 2019-11-06 18:20:59 · 189 阅读 · 0 评论 -
洛谷 P2746 [USACO5.3]校园网Network of Schools tarjan缩点
https://www.luogu.org/problem/P2746题目描述一些学校连入一个电脑网络。那些学校已订立了协议:每个学校都会给其它的一些学校分发软件(称作“接受学校”)。注意即使 B 在 A 学校的分发列表中, A 也不一定在 B 学校的列表中。你要写一个程序计算,根据协议,为了让网络中所有的学校都用上新软件,必须接受新软件副本的最少学校数目(子任务 A)。更进一步,我们想要确...原创 2019-11-06 15:25:53 · 119 阅读 · 0 评论 -
洛谷 P3469 [POI2008]BLO-Blockade tarjan求割点+组合数学
https://www.luogu.org/problem/P3469题目描述There are exactly nn towns in Byteotia.Some towns are connected by bidirectional roads.There are no crossroads outside towns, though there may be bridges, tu...原创 2019-11-06 15:02:08 · 129 阅读 · 0 评论 -
洛谷 P2341 [HAOI2006]受欢迎的牛|【模板】强连通分量 tarjan缩点
https://www.luogu.org/problem/P2341题目大意:给出牛与牛之间的关系:(x,y)(x,y)(x,y)代表第xxx只牛认为第yyy只牛是受欢迎的,这个关系是可以传递的。问被其他所有牛认为是受欢迎的牛的个数。思路:(x,y)(x,y)(x,y)代表从xxx到yyy的一条有向边,显然图的每个强连通分量中的牛在这个分量内是满足题意的,我们把强连通分量缩点,就得到一个DA...原创 2019-11-06 00:52:46 · 194 阅读 · 0 评论 -
洛谷 P1726 上白泽慧音 tarjan求强连通分量
https://www.luogu.org/problem/P1726题目描述在幻想乡,上白泽慧音是以知识渊博闻名的老师。春雪异变导致人间之里的很多道路都被大雪堵塞,使有的学生不能顺利地到达慧音所在的村庄。因此慧音决定换一个能够聚集最多人数的村庄作为新的教学地点。人间之里由N个村庄(编号为1…N)和M条道路组成,道路分为两种一种为单向通行的,一种为双向通行的,分别用1和2来标记。如果存在由村庄...原创 2019-10-29 23:54:25 · 164 阅读 · 0 评论 -
CodeForces 1213F Unstable String Sort 强连通分量+拓扑排序
题目大意:构造一个长度为nnn的字符串SSS,使其至少包含kkk个不同的小写字母,且对于给定的序列PPP和序列QQQ,满足S[Pi−1]<=S[Pi]且S[Qi−1]<=S[Qi]S[P_{i-1}]<=S[P_{i}]且S[Q_{i-1}]<=S[Q_{i}]S[Pi−1]<=S[Pi]且S[Qi−1]<=S[Qi](1<=i<=n−11&...原创 2019-09-25 12:45:19 · 248 阅读 · 0 评论 -
POJ 2942 Knights of the Round Table 补图+点双连通分量+染色法判二分图
http://poj.org/problem?id=2942Being a knight is a very attractive career: searching for the Holy Grail, saving damsels in distress, and drinking with the other knights are fun things to do. Therefore...原创 2019-08-16 18:44:55 · 179 阅读 · 0 评论 -
POJ 1144 Network tarjan求割点
http://poj.org/problem?id=1144A Telephone Line Company (TLC) is establishing a new telephone cable network. They are connecting several places numbered by integers from 1 to N . No two places have th...原创 2019-08-16 16:46:00 · 120 阅读 · 0 评论 -
POJ 2186 Popular Cows tarjan强连通分量+缩点
http://poj.org/problem?id=2186Every cow's dream is to become the most popular cow in the herd. In a herd of N (1 <= N <= 10,000) cows, you are given up to M (1 <= M <= 50,000) ordered pai...原创 2019-08-16 16:09:57 · 128 阅读 · 0 评论 -
HDU 5934 Bomb tarjan强连通分量+缩点
http://acm.hdu.edu.cn/showproblem.php?pid=5934There are N bombs needing exploding.Each bomb has three attributes: exploding radius ri, position (xi,yi) and lighting-cost ci which means you need to p...原创 2019-08-16 14:33:51 · 195 阅读 · 0 评论 -
洛谷 P3387 【模板】缩点 tarjan缩点+记忆化搜索
https://www.luogu.org/problem/P3387题目背景缩点+DP题目描述给定一个n个点m条边有向图,每个点有一个权值,求一条路径,使路径经过的点权值之和最大。你只需要求出这个权值和。允许多次经过一条边或者一个点,但是,重复经过的点,权值只计算一次。输入格式第一行,n,m第二行,n个整数,依次代表点权第三至m+2行,每行两个整数u,v,表示u->v有一...原创 2019-08-16 11:23:31 · 134 阅读 · 0 评论 -
POJ 1236 Network of Schools 强连通分量+缩点(tarjan)
http://poj.org/problem?id=1236A number of schools are connected to a computer network. Agreements have been developed among those schools: each school maintains a list of schools to which it distribu...原创 2019-08-16 10:58:01 · 135 阅读 · 0 评论 -
Tarjan算法与有向图连通性(强连通分量)
搜索树:给定有向图G=(V,E)G=(V,E)G=(V,E),若存在r∈Vr\in Vr∈V,满足从rrr出发能够到达VVV中所有的点,则称GGG是一个"流图",记为(G,r)(G,r)(G,r),其中rrr称为流图的源点。在一个流图(G,r)(G,r)(G,r)上从rrr出发进行深度优先遍历,每个点只访问一次。所有发生递归的边(x,y)(x,y)(x,y)(也即从xxx到yyy是对yyy的第一...原创 2019-08-16 10:44:38 · 346 阅读 · 0 评论 -
POJ 3694 Network tarjan找桥+LCA
http://poj.org/problem?id=3694A network administrator manages a large network. The network consists of N computers and M links between pairs of computers. Any pair of computers are connected directly...原创 2019-08-15 19:06:08 · 155 阅读 · 0 评论 -
BZOJ 1123 tarjan求割点+组合数学
https://www.lydsy.com/JudgeOnline/problem.php?id=1123Byteotia城市有n个 towns m条双向roads. 每条 road 连接 两个不同的 towns ,没有重复的road. 所有towns连通。Input输入n<=100000 m<=500000及m条边Output输出n个数,代表如果把第i个点去掉,将有多少对...原创 2019-08-15 15:16:28 · 204 阅读 · 0 评论 -
Tarjan算法与无向图连通性(割点\割边\双连通分量\缩点)
TarjanTarjanTarjan算法与无向图连通性无向图的割点与桥:给定无向连通图G=(V,E)G=(V,E)G=(V,E):若对于x∈Vx\in Vx∈V,从图中删去节点xxx以及所有与xxx关联的边之后,GGG分裂成两个或两个以上不相连的子图,则称xxx为GGG的割点。若对于e∈Ee\in Ee∈E,从图中删去边eee之后,GGG分裂成两个不相连的子图,则称eee为GGG的桥或割边...原创 2019-08-15 14:36:44 · 875 阅读 · 0 评论