摘要: 洛谷P2756 匈牙利算法: #include<bits/stdc++.h> using namespace std; const int N=110; int match[N],vis[N]; int n,m; vector<int> edges[N]; bool dfs(int u){ for( 阅读全文
posted @ 2025-10-07 15:41 xdhking 阅读(6) 评论(0) 推荐(0)
摘要: 方法 二分图转换成网络流模型;创建虚拟源点和汇点,将源点连上左边所有点,右边所有点连上汇点,容量皆为1。原来的每条边从左往右连边,容量也皆为1,最大流即最大匹配。 code:洛谷P3386 dinic: #include<bits/stdc++.h> using namespace std; typ 阅读全文
posted @ 2025-10-07 13:04 xdhking 阅读(24) 评论(0) 推荐(0)
摘要: 洛谷p5905 #include<bits/stdc++.h> using namespace std; #define endl '\n' typedef long long LL; typedef pair<int,int> PII; const int N=3e3+10,INF=1e9; ve 阅读全文
posted @ 2025-10-06 17:40 xdhking 阅读(11) 评论(0) 推荐(0)
摘要: 模板洛谷P4951 #include<iostream> #include<algorithm> #include<vector> using namespace std; const int N=410,M=1e4+10; const double eps=1e-6; typedef long l 阅读全文
posted @ 2025-10-06 00:07 xdhking 阅读(8) 评论(0) 推荐(0)
摘要: 洛谷p4782 #include<iostream> #include<vector> #include<algorithm> using namespace std; const int N=2e6+10; int n,m; int dfn[N],low[N],stk[N],instk[N],to 阅读全文
posted @ 2025-10-05 21:20 xdhking 阅读(8) 评论(0) 推荐(0)
摘要: 后续补充完善 点双连通分量缩点后建的新图点的数量会增加,如果原图是一条链的话每个点双开个新点,加上割点,总点数要开两倍; 无向基环树用拓扑剥叶子的时候,记得防止剥父亲节点的出度 void topsort(){ queue<int> q; for(int i=1;i<=n;i++){ if(dg[i] 阅读全文
posted @ 2025-10-05 15:54 xdhking 阅读(6) 评论(0) 推荐(0)
摘要: 模板题:洛谷p3381 #include<bits/stdc++.h> using namespace std; const int N=5e3+10,M=5e4+10,INF=0x3f3f3f3f; typedef long long LL; int n,m,s,t,id=1; int e[M<< 阅读全文
posted @ 2025-10-03 14:22 xdhking 阅读(6) 评论(0) 推荐(0)
摘要: 标准模板 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N=210,M=5e3+10; int n,m,s,t,d[N],cur[N],vis[N]; int h[N],e[M<<1],ne[ 阅读全文
posted @ 2025-10-02 22:22 xdhking 阅读(7) 评论(0) 推荐(0)
摘要: 模板:洛谷p3376 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N=210,M=5e3+10; int n,m,s,t,d[N],cur[N]; int h[N],e[M<<1],ne[M 阅读全文
posted @ 2025-10-02 21:25 xdhking 阅读(11) 评论(0) 推荐(0)
摘要: 模板:洛谷p3386 #include<bits/stdc++.h> using namespace std; const int N=5e4+10; int vis[N],match[N]; vector<int> edges[N]; int n,m,e; bool dfs(int u){ for 阅读全文
posted @ 2025-10-02 19:45 xdhking 阅读(7) 评论(0) 推荐(0)