
网络流及二分图
algzjh
这个作者很懒,什么都没留下…
展开
-
最大流-EK算法
示例题目: HDU3549#include<iostream>#include<cstdio>#include<vector>#include<queue>#include<algorithm>#include<cstring>using namespace std;const int MAXN=20;//点数的最大值const int MAXM=2005;//边数的最大值cons原创 2017-08-14 15:40:33 · 889 阅读 · 0 评论 -
hungury算法
#include <iostream>#include <string.h>using namespace std;bool G[110][110];bool vis[110];int link[110];int n;bool match(int u){ for(int i=1;i<=n;i++){ if(G[u][i]&...原创 2018-08-08 00:11:45 · 933 阅读 · 0 评论 -
最小费用最大流
SPFA#include&amp;lt;bits/stdc++.h&amp;gt;using namespace std;const int MAXN = 1000;const int MAXM = 10000;const int INF = 0x3f3f3f3f;struct Edge{ int v,c,w,nxt; // v 表示边的另一个顶点, // c 表示当前剩余...转载 2018-08-12 13:15:01 · 749 阅读 · 0 评论 -
Dinic最大流
#include&amp;lt;bits/stdc++.h&amp;gt;using namespace std;const int MAXN = 100; //X 集合中的顶点数上限const int MAXM = 10000; // 总的边数上限const int INF = 0x3f3f3f3f;struct Edge{ int v,c,nxt; // v 是指边的另一个顶...转载 2018-08-12 09:57:28 · 494 阅读 · 0 评论 -
二分图带权匹配-KM算法
例题:牛客多校第五场-roomconst int MAXN=105;int w[MAXN][MAXN];//边权int la[MAXN],lb[MAXN];//左、右部点的顶标bool va[MAXN],vb[MAXN];//访问标记:是否在交错树中int match[MAXN];//右部点匹配了哪一个左部点int n,delta;bool dfs(int x){ va[...转载 2018-08-03 16:25:29 · 516 阅读 · 0 评论 -
HDU3549-Flow Problem
Flow ProblemTime Limit: 5000/5000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) Total Submission(s): 16692 Accepted Submission(s): 7867Problem Description Network flow is a well-kn原创 2017-08-02 17:31:03 · 653 阅读 · 0 评论 -
dfs染色
vector<int> G[MAXN];int V;int color[MAXN];bool dfs(int v,int c){ color[v]=c; for(int i=0;i<G[v].size();i++) { if(color[G[v][i]]==c) return false; if(color[G[v][i]]==0&&!d原创 2017-08-26 16:07:15 · 951 阅读 · 0 评论 -
Hopcroft-Karp算法
///Hopcroft-Carp///复杂度O(sqrt(n)*E)///邻接表存图,vector实现///vector先初始化,然后加入边///uN为左端的顶点数,使用前赋值(点编号0开始)#include<iostream>#include<cstring>#include<cstdio>#include<vector>#include<queue>#include<algo转载 2017-08-25 13:58:29 · 769 阅读 · 0 评论 -
HDU6178-Monkeys
MonkeysTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 153428/153428 K (Java/Others) Total Submission(s): 729 Accepted Submission(s): 234Problem Description There is a tree having N vertic原创 2017-08-25 17:15:28 · 528 阅读 · 0 评论 -
POJ1274-The Perfect Stall
The Perfect StallTime Limit: 1000MS Memory Limit: 10000K Total Submissions: 26274 Accepted: 11672 DescriptionFarmer John completed his new barn just last week, complete with all the lates原创 2017-08-25 16:18:14 · 533 阅读 · 0 评论 -
HDU2255-奔小康赚大钱
奔小康赚大钱Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 10370 Accepted Submission(s): 4601Problem Description 传说在遥远的地方有一个非常富裕的村落,有一天,村长决定进行制度转载 2017-08-22 08:40:47 · 621 阅读 · 0 评论 -
二分图匹配
小小粉丝度度熊Accepts: 1075 Submissions: 5191 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Problem Description度度熊喜欢着喵哈哈村的大明星——星星小姐。为什么度度熊会喜欢星星小姐呢?首先星星小姐笑起来非常动人,其次星星小姐唱歌转载 2017-08-14 20:45:26 · 667 阅读 · 0 评论 -
最小费用最大流(Bellman-Ford找增广路)
示例题目: POJ2135#include<iostream>#include<cstdio>#include<vector>#include<queue>#include<algorithm>#include<cstring>using namespace std;typedef long long LL;const int MAXN=1e3+50;//点数的最大值const i原创 2017-08-14 16:59:30 · 2063 阅读 · 0 评论 -
Hungary算法
function HungarianAlgorithm(Left,Right,G) maxMatch = 0 initiate an array matchedTo with -1 for each node u in Left part initiate an array visited with false if dfs(u) is tr...原创 2018-08-08 08:48:17 · 699 阅读 · 0 评论