上一页 1 ··· 36 37 38 39 40 41 42 43 44 ··· 54 下一页
  2022年11月26日
摘要: 一些直白的理解,和标准定义有差别,但也足够了 点双连通:一个图任意去掉一个点后仍然联通( 或者说任意两点件都有两条路径(无任何重叠的边) ) ; 边双连通同理 割点:去掉某个点后,图不连通 割边同理 求割点 ( low[y]>=dfn[x] ) #include <bits/stdc++.h> us 阅读全文
posted @ 2022-11-26 11:57 towboat 阅读(36) 评论(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 阅读(30) 评论(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 阅读(24) 评论(0) 推荐(0)
摘要: 每头奶牛都梦想成为牛棚里的明星。被所有奶牛喜欢的奶牛就是一头明星奶牛。 每头奶牛总是喜欢自己的。奶牛之间的“喜欢”是可以传递的 问有多少头奶牛可以当明星 缩点为DAG, 求出度为0的点 #include <bits/stdc++.h> using namespace std ; const int 阅读全文
posted @ 2022-11-25 23:22 towboat 阅读(23) 评论(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 阅读(48) 评论(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 阅读(19) 评论(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 阅读(54) 评论(0) 推荐(0)
摘要: 图上每个点有一头牛,现在牛群聚集到点X上聚会,然后又回到各自的点,而且牛只走最短路径 问所有最短路中最长的一条( 路径包含来回) 正反跑一次 spfa(X) , spfa(i) , ans=max{ d0[i]+ dis[X] } #include <iostream> #include <cstr 阅读全文
posted @ 2022-11-12 09:54 towboat 阅读(66) 评论(0) 推荐(0)
摘要: 在加权无向图上求出一条从 1 号结点到 N 号结点的路径,使路径上第 K + 1 大的边权尽量小 二分答案md, 判断1~n是否存在一条路径,花费不超过md 把w<=md 的边看作0,否则看作1,求1到n 的最短路,看 dis[n]<=md #include <bits/stdc++.h> usin 阅读全文
posted @ 2022-11-12 09:15 towboat 阅读(144) 评论(0) 推荐(0)
  2022年11月11日
摘要: 给你一个无向带权连通图,每条边是黑色或白色。求一棵最小权的恰好有 K 条白色边的生成树。题目保证有解 二分一个增加量md, 给每个白边权值加md , 跑一下kruskal , 看贪心取了多少白边,和K比较检验答案 #include <bits/stdc++.h> using namespace st 阅读全文
posted @ 2022-11-11 17:34 towboat 阅读(54) 评论(0) 推荐(0)
上一页 1 ··· 36 37 38 39 40 41 42 43 44 ··· 54 下一页