随笔分类 - 图论--网络流&&费用流
摘要:1,从各个顾客到汇点各有一条边,容量就是各个顾客能买的数量上限。 2,在某一轮中,从该顾客打开的所有猪圈都有一条边连向该顾客,容量都是∞。 3,最后一轮除外,从每一轮的i号猪圈都有一条边连向下一轮的i号猪圈,容量都是∞,表示这一轮剩下的猪可以留到下一轮。 4,最后一轮除外,从每一轮被打开的所有猪圈,
阅读全文
摘要:网1:飞行员匹配 题目链接:https://www.oj.swust.edu.cn/problem/show/1736 俩种做法: /**********二分图匹配做法***********/ #include<bits/stdc++.h> using namespace std; const in
阅读全文
摘要:bool spfa(){ queueque; que.push(s); memset(dis,INF,sizeof(dis)); dis[s]=0; while(!que.empty()){ int u=que.front(); que.pop(); vis[u]=0; for(int i=head[u];~i;i=edge[i].nextt){ int v=ed...
阅读全文
摘要:bool bfs(){ memset(deep,0,sizeof(deep)); queueque; que.push(s); deep[s]=1; while(!que.empty()){ int u=que.front(); que.pop(); for(int i=head[u];i!=-1;i=e[i].nextt){ int v=e[i].v; if(...
阅读全文
摘要:题:http://acm.hdu.edu.cn/showproblem.php?pid=6126 题意:题目给出n,m,k 然后给出n*m的矩阵a[i][j]代表第i个人在获得j 颗糖果能得到的满足值; k行[x,y,z]表示第x个人的糖果减去第y个人的糖果需要不大于z。 分析: 因为题目的z可能为
阅读全文

浙公网安备 33010602011771号