随笔分类 -  图论——二分图

摘要:记横联通是一块横着的没有硬石头的地,把他们编号。竖联通同理。 对于一个空地,将其横联通编号和竖联通编号连边,二分图匹配,最大匹配为答案。 cpp include include include include using namespace std; int n, m, hr[55][55], sr 阅读全文
posted @ 2018-05-04 11:02 poorpool 阅读(150) 评论(0) 推荐(0)
摘要:给出的图是一个二分图(显然……吗),一个图的最大团=其补图的最大独立集,因此二分图的最大独立集就是补图的最大团。 欲使补图最大团变大,则要最大独立集变大。二分图最大独立集=点数 最小点覆盖。最小点覆盖=最大匹配。 即搞掉哪些边使得最大匹配变小。即二分图的必经边。 二分图的必经边的判断:流量为 $1$ 阅读全文
posted @ 2018-04-15 20:17 poorpool 阅读(292) 评论(0) 推荐(0)
摘要:二分图的(不)可行边。 cpp include include include include include using namespace std; int n, m, T, ss, tt, hea[20005], cnt, uu[100005], vv[100005], cur[20005], 阅读全文
posted @ 2018-04-08 11:28 poorpool 阅读(558) 评论(0) 推荐(0)
摘要:最小路径可重点覆盖。先传递闭包,然后拆点,$n $最大匹配,看算法竞赛进阶指南。 cpp include include include using namespace std; int n, m, uu, vv, mat[205], ans; bool w[205][205], vis[205]; 阅读全文
posted @ 2018-04-08 09:20 poorpool 阅读(203) 评论(0) 推荐(0)
摘要:分数规划+KM 算法 这个KM不好,看算法竞赛进阶指南的 阅读全文
posted @ 2018-03-18 16:48 poorpool 阅读(197) 评论(0) 推荐(0)
摘要:参见 "这里" cpp include include include using namespace std; int n, a[305][305], mat[305], exu[305], exv[305], qiw[305]; const int oo=0x3f3f3f3f; bool viu 阅读全文
posted @ 2018-03-17 20:51 poorpool 阅读(159) 评论(1) 推荐(0)
摘要:注意一个景点只能去一次。 cpp include include include include include using namespace std; int n, m, xx[205], yy[205], hea[205], ss, tt, cnt, lev[205], maxFlow; co 阅读全文
posted @ 2018-01-19 15:57 poorpool 阅读(164) 评论(0) 推荐(0)
摘要:前置技能:poj3041 如果是二维平面有一些方块,这些方块被染了黑色,你每次可以选择 $(x,y)$ 的区域染成白色,代价是 $\min(x,y)$,问你付出的最小代价 显然我们不会这么染 因为这样我们的代价是 $\min(x,y)$,为了研究的方便我们假设 $x$ 比 $y$ 小,那我们就相当于 阅读全文
posted @ 2018-01-19 10:55 poorpool 阅读(187) 评论(0) 推荐(0)
摘要:二分图。对于每个点,将他的 x 与 y 连一条边,求最小点覆盖 二分图最小点覆盖等于最大匹配 include include include using namespace std; int n, k, hea[505], cnt, lnk[1005], ans, uu, vv; bool vis[ 阅读全文
posted @ 2018-01-19 09:13 poorpool 阅读(105) 评论(0) 推荐(0)
摘要:```cpp include include include using namespace std; int n, e[10005][2], lnk[20005], d, ans[10005]; bool vis[20005]; bool dfs(int x){ for(int i=0; i n; 阅读全文
posted @ 2018-01-19 07:50 poorpool 阅读(122) 评论(0) 推荐(0)
摘要:其实,只用考虑某一行能否放到某一行就行了 cpp include include include using namespace std; int T, n, a[205][205], hea[405], cnt, ans, lnk[405]; bool vis[405]; struct Edge{ 阅读全文
posted @ 2018-01-16 08:29 poorpool 阅读(130) 评论(0) 推荐(0)
摘要:二分图匹配,一边是属性值,一边是武器 cpp include include include using namespace std; int n, lst[1010005], uu, vv, hea[10005], cnt, ans; bool vis[1010005]; struct Edge{ 阅读全文
posted @ 2018-01-15 18:21 poorpool 阅读(95) 评论(0) 推荐(0)
摘要:参考胡伯涛论文,真是个好东西! 最大流=最小割 最大权闭合图=总正权值 “最小简单割” 太空飞行计划问题 最小点权覆盖集=“最小割” 覆盖集与独立集互补 最大点权独立集=总权 最小点权覆盖集 最小点覆盖数 = 最大匹配数 阅读全文
posted @ 2018-01-02 21:08 poorpool 阅读(263) 评论(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)
摘要:luogu 匈牙利算法 cpp include include include using namespace std; int n, m, uu, vv, e, lnk[1005], ans; bool a[1005][1005], vis[1005]; bool dfs(int u){ for( 阅读全文
posted @ 2017-12-21 21:01 poorpool 阅读(173) 评论(0) 推荐(0)