![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
floyd
live4m
老菜逼了
展开
-
CodeForces296 D.Greg and Graph(逆向floyd插点)
D. Greg and GraphGreg has a weighed directed graph, consisting of n vertices. In this graph any pair of distinct vertices has an edge between them in both directions. Greg loves playing with the grap...原创 2019-11-07 23:33:27 · 315 阅读 · 0 评论 -
floyd传递闭包水题
变形课hdu1181#include<iostream>#include<cstdio>typedef long long ll;const int inf=0x3f3f3f3f;const int inn=0x80808080;using namespace std;const int maxm=30;int g[maxm][maxm];int mai...原创 2019-05-30 13:35:23 · 228 阅读 · 0 评论 -
hdu6152 Friend-Graph (floyd传递闭包+暴力)
Friend-Graphhdu6152问题描述众所周知,小团体不利于团队的发展。因此,在一个好的团队中不应该有任何小组。在一个有n个成员的团队中,如果有3个或3个以上的成员彼此不是朋友,或者有3个或3个以上的成员彼此是朋友。满足上述条件的团队可以称为坏团队。否则,这个团队就是一个好团队。一个公司要对这个公司的每个团队进行评估。我们已经了解了n个成员的团队以及这n个人之间所有的朋友关系。请...原创 2019-05-30 13:35:06 · 147 阅读 · 0 评论 -
uva247 Calling Circles (缩点 或 传递闭包)
题意:如果两个人能够互相打电话(直接或者间接),则说他们在同一个电话圈里。例如,a打给b,b打给c,c打给d,d打给a,则这四个人在同一个圈里;如果e打给f,而f不打给e,则不能推出e和f在同一个电话圈。输入n(n<=25)个人的m次电话,找出所有的电话圈。人名只包含字母,不超过25个字符,且不重复。分析:一看就是强连通缩点题。但是据说传递闭包也可以写。两个都写了一遍ps:写完这...原创 2019-06-11 08:51:52 · 128 阅读 · 0 评论 -
codeforces 1202B. You Are Given a Decimal String... (最短路floyd)
B. You Are Given a Decimal String…Suppose you have a special x-y-counter. This counter can store some value as a decimal number; at first, the counter has value 0.The counter performs the following ...原创 2019-08-10 23:59:25 · 215 阅读 · 0 评论 -
hdu3631 Shortest Path (floyd 插点法)
Shortest Path题意:给n、m、q,表示n个点m条边q个询问每个询问两种方式0 x,表示标记x,如果已经被标记就输出ERROR! At point x1 x y,表示输出x到y的最短距离,要求x和y都及其最短路径上的点都被标记过,如果x或y没有被标记输出ERROR! At path x to y,如果x到y之间没有路径就输出No such pathSample Input5...原创 2019-08-22 09:21:41 · 204 阅读 · 0 评论 -
poj1734 Sightseeing trip (输出最小环路径)
题意:n个点m条边,如果图中有环,输出最小环路径,否则输出"No solution."思路:开一个pre[][]数组pre[i][j]表示i到j最短路上j的入点(前驱)每当任意两点i,j之间的最短路更新,同时更新pre[i][j]查找路径操作具体看代码code:#include<iostream>#include<algorithm>#include&...原创 2019-10-03 09:55:04 · 811 阅读 · 0 评论