上一页 1 ··· 36 37 38 39 40 41 42 43 44 ··· 54 下一页
  2022年11月26日
摘要: 给一张图加边成为双连通分量( 任意两点之间都有两条不重叠的道路) 缩点得到树,ans= (leaf_num+1)/2 一条无向边只走一次 (flag==0) #include <bits/stdc++.h> using namespace std ; const int N=6000,M=7*1e4 阅读全文
posted @ 2022-11-26 17:44 towboat 阅读(159) 评论(0) 推荐(0)
摘要: 给一个无向图,选择一些点,使得任意去掉一个点后,任一点都可以连接到至少一个选择的点 缩点后,每个块: 1. 割点数量为0, 要建立2个站点, 方案+= len(len-1) 2. 数量为1,建立1个站点 方案+=len-1 #include <bits/stdc++.h> using namespa 阅读全文
posted @ 2022-11-26 12:05 towboat 阅读(133) 评论(0) 推荐(0)
摘要: 一些直白的理解,和标准定义有差别,但也足够了 点双连通:一个图任意去掉一个点后仍然联通( 或者说任意两点件都有两条路径(无任何重叠的边) ) ; 边双连通同理 割点:去掉某个点后,图不连通 割边同理 求割点 ( low[y]>=dfn[x] ) #include <bits/stdc++.h> us 阅读全文
posted @ 2022-11-26 11:57 towboat 阅读(54) 评论(0) 推荐(0)
摘要: 从起点S到终点T,求一条路线获得最多的收益( 每个点收益a[i] ) , 可以重复通过路和点 裸题 缩点+最长路 #include <bits/stdc++.h> using namespace std ; const int N=5e5+2; int n,m,pool,a[N]; int low[ 阅读全文
posted @ 2022-11-26 01:12 towboat 阅读(57) 评论(0) 推荐(0)
  2022年11月25日
摘要: 缩点求DAG最长路 tarjan缩点:给一个强连通分量内的点打标记,缩为新的点,建立新的图( DAG ) #include <bits/stdc++.h> using namespace std ; const int N=1e4+2; int n,m,a[N]; int pool,low[N],d 阅读全文
posted @ 2022-11-25 23:33 towboat 阅读(52) 评论(0) 推荐(0)
摘要: 每头奶牛都梦想成为牛棚里的明星。被所有奶牛喜欢的奶牛就是一头明星奶牛。 每头奶牛总是喜欢自己的。奶牛之间的“喜欢”是可以传递的 问有多少头奶牛可以当明星 缩点为DAG, 求出度为0的点 #include <bits/stdc++.h> using namespace std ; const int 阅读全文
posted @ 2022-11-25 23:22 towboat 阅读(45) 评论(0) 推荐(0)
  2022年11月12日
摘要: 从1出发访问 5个给定点,最小化路程 枚举5个点的排列,然后单源最短路 #include <iostream> #include <cstring> #include <queue> using namespace std ; struct T{ int y,z; T(int y0,int z0){ 阅读全文
posted @ 2022-11-12 12:43 towboat 阅读(82) 评论(0) 推荐(0)
摘要: 求1到n的 次短路 #include <iostream> #include <cstring> #include <queue> using namespace std ; const int N=1e6+2,M=5e6+2; const int inf=0x3f3f3f3f; int all,n 阅读全文
posted @ 2022-11-12 10:56 towboat 阅读(36) 评论(0) 推荐(0)
摘要: 问1~n的最短路有几个 #include <iostream> #include <cstring> #include <queue> using namespace std ; const int N=1e6+2,M=2e6+2; const int inf=0x3f3f3f3f,mod=1000 阅读全文
posted @ 2022-11-12 10:21 towboat 阅读(87) 评论(0) 推荐(0)
摘要: 图上每个点有一头牛,现在牛群聚集到点X上聚会,然后又回到各自的点,而且牛只走最短路径 问所有最短路中最长的一条( 路径包含来回) 正反跑一次 spfa(X) , spfa(i) , ans=max{ d0[i]+ dis[X] } #include <iostream> #include <cstr 阅读全文
posted @ 2022-11-12 09:54 towboat 阅读(86) 评论(0) 推荐(0)
上一页 1 ··· 36 37 38 39 40 41 42 43 44 ··· 54 下一页