随笔分类 -  图论——网络流

摘要:把m个师傅拆成n个阶段,考虑每个人选上第某个阶段的某师傅对答案做出的贡献。 参见 "这里" 与 "那里" 。 cpp include include include include using namespace std; int m, n, uu, cnt, hea[605], ss, tt, m 阅读全文
posted @ 2018-01-04 09:27 poorpool 阅读(138) 评论(0) 推荐(0)
摘要:要想限制流量,总要想着拆点。 cpp include include include include using namespace std; int n, m, ss, tt, uu, vv, ww, maxFlow, minCost, cnt, hea[405], pre[405]; int d 阅读全文
posted @ 2018-01-03 08:28 poorpool 阅读(114) 评论(0) 推荐(0)
摘要:参考胡伯涛论文,真是个好东西! 最大流=最小割 最大权闭合图=总正权值 “最小简单割” 太空飞行计划问题 最小点权覆盖集=“最小割” 覆盖集与独立集互补 最大点权独立集=总权 最小点权覆盖集 最小点覆盖数 = 最大匹配数 阅读全文
posted @ 2018-01-02 21:08 poorpool 阅读(263) 评论(0) 推荐(0)
摘要:最大点权独立集,参见胡伯涛论文 cpp include include include include using namespace std; int m, n, a[105][105], hea[10005], ss, tt, tot, maxFlow, lev[10005], cnt; con 阅读全文
posted @ 2018-01-02 21:06 poorpool 阅读(138) 评论(0) 推荐(0)
摘要:第一问DP水过。dp[i]代表以i结尾的最长不下降子序列长度。 二三问网络流。 第二问是说每个子序列不能重复使用某个数字。 把每个点拆成p(i),q(i)。连边。 要是dp[i]=1,连源,p(i) 要是dp[i]=s,连q(i),汇 要是i include include include usin 阅读全文
posted @ 2018-01-02 09:27 poorpool 阅读(136) 评论(0) 推荐(0)
摘要:最小路径覆盖, "看这里" cpp include include include include using namespace std; struct Edge{ int too, nxt, val; }edge[15005]; int n, m, hea[305], ss, tt, uu, v 阅读全文
posted @ 2017-12-27 21:23 poorpool 阅读(111) 评论(0) 推荐(0)
摘要:倘若某个试题已经被选到某个类型里了,那么它就不可再被选进别的类型了。 所以,对于每个类型,我们将其与汇连边,权值是它的要求的题目数量。 对于每个题目,我们将源与其连边,权值是1,代表只能用一次。然后再将其与它所对应的所有类型连边。 倘若最大流小于m,则说明不能组卷。 输出路径我觉得还是比较好做的,对 阅读全文
posted @ 2017-12-27 10:59 poorpool 阅读(114) 评论(0) 推荐(0)
摘要:最大权闭合子图 参考 "这" ,胡伯涛论文。 10,8,6,3这个简单割对应的闭合子图是A1,B1,B2 输出路径时,最后一次层次图中,与源点相连的点即选做的实验,与汇点相连的点即选用的仪器。 cpp include include include include using namespace s 阅读全文
posted @ 2017-12-27 08:38 poorpool 阅读(142) 评论(0) 推荐(0)
摘要:源向地球连 月球向汇连 每一天往下一天连 飞船上一天与这一天连 枚举答案 cpp include include include include using namespace std; struct Edge{ int too, nxt, val; }edge[1000005]; int n, m 阅读全文
posted @ 2017-12-26 08:36 poorpool 阅读(122) 评论(0) 推荐(0)
摘要:网络流不用动脑子的好爽啊 cpp include include include include using namespace std; int n, uu, hea[105], cnt, ss, tt, sum, minCost, pre[105], dis[105]; const int oo 阅读全文
posted @ 2017-12-25 21:12 poorpool 阅读(111) 评论(0) 推荐(0)
摘要:匈牙利 cpp include include include using namespace std; int n, m, lst[105], uu, vv, cnt, ans; bool edge[105][105], vis[105]; bool dfs(int x){ for(int i=m 阅读全文
posted @ 2017-12-25 19:25 poorpool 阅读(117) 评论(0) 推荐(0)
摘要:ss是源点,代表餐巾卖家,tt是汇点,代表记账收钱者。 记p(i)是i天早晨的可用毛巾数,q(i)是i天完了的废毛巾数。 建图见注释 cpp include include include include using namespace std; typedef long long ll; int 阅读全文
posted @ 2017-12-25 18:41 poorpool 阅读(110) 评论(0) 推荐(0)
摘要:每次选代价最小的流增广 cpp include include include include using namespace std; struct Edge{ int too, nxt, val, cst; }edge[100005]; int n, m, ss, tt, maxFlow, mi 阅读全文
posted @ 2017-12-21 19:39 poorpool 阅读(114) 评论(3) 推荐(0)
摘要:当前弧优化 cpp include include include include using namespace std; int n, m, ss, tt, hea[10005], cnt, uu, vv, ww, maxFlow, cur[10005]; int lev[10005]; con 阅读全文
posted @ 2017-12-20 19:26 poorpool 阅读(210) 评论(0) 推荐(0)
摘要:练一下最大流 cpp include include include include using namespace std; int n, m, ron[205][205], pre[205], uu, vv, ww, vis[205]; queue d; int ek(){ int maxFlo 阅读全文
posted @ 2017-12-20 11:09 poorpool 阅读(139) 评论(3) 推荐(0)