摘要: 最短路 弗洛伊德:全源最短路: \[\Large DP方程:\\ dp[i][j] = min(dp[i] [j],dp[i][k]+dp[k] [j]) \]#include <cstdio> #include <algorithm> #include <iostream> #include <c 阅读全文
posted @ 2024-08-16 22:10 phrink 阅读(20) 评论(0) 推荐(0)
摘要: 2-Sat \[\begin{align*} &\LARGE\color{Red}大意:\\ &有n个数a_i,m个约束条件都需要满足\\ &条件形如(i,a,j,b) \quad a_i=a \ \text{or} \ a_j=b\\\\\\ &\LARGE\color{Red}思路:\\ &让a 阅读全文
posted @ 2024-08-16 20:41 phrink 阅读(14) 评论(0) 推荐(0)
摘要: P3388 【模板】割点 Note:图可能不联通,因此每次tarjan都要更新root #include <cstdio> #include <stack> #include <cmath> #include <algorithm> #include <iostream> #include <cst 阅读全文
posted @ 2024-08-16 20:38 phrink 阅读(15) 评论(0) 推荐(0)
摘要: [P2746 USACO5.3] 校园网Network of Schools 大意:一个图 可能有环 a:求deg入度为0的点的个数 b:至少加多少条边让图所有点可以互相到达 思路:看代码 #include <cstdio> #include <queue> #include <deque> #in 阅读全文
posted @ 2024-08-16 20:34 phrink 阅读(14) 评论(0) 推荐(0)