随笔分类 -  二分图

摘要:https://www.jvruo.com/archives/215/ https://www.renfei.org/blog/bipartite-matching.html 阅读全文
posted @ 2020-05-01 18:36 feibilun 阅读(77) 评论(0) 推荐(0)
摘要:Link Solution 1 Hungarian: class Solution { public: int m,n; vector<vector<int>> g; vector<vector<int>> dir={{0,-1},{-1,-1},{1,-1},{0,1},{-1,1},{1,1}} 阅读全文
posted @ 2020-02-11 09:55 feibilun 阅读(184) 评论(0) 推荐(0)
摘要:题目链接 题解: 每一个子连通图,对它进行黑白染色,然后取两种染色中的最小值,然后最后汇总。 #include <bits/stdc++.h> # define LL long long using namespace std; const int maxn=10000+10; const int 阅读全文
posted @ 2020-02-05 17:34 feibilun 阅读(132) 评论(0) 推荐(0)
摘要:题目链接 题解: 我们可以对棋盘进行黑白染色,使得任意相邻的两个格子颜色不相同,然后进行二分图最大匹配。 Code: 1 class Solution { 2 public: 3 int N; 4 int M; 5 6 vector<vector<int>> dir{{1,0},{0,1},{-1, 阅读全文
posted @ 2020-02-02 09:41 feibilun 阅读(230) 评论(0) 推荐(0)
摘要:题目链接 Code: 1 class Solution { 2 public: 3 int sub; 4 int assignBikes(vector<vector<int>>& workers, vector<vector<int>>& bikes) { 5 int N=workers.size( 阅读全文
posted @ 2020-02-02 09:30 feibilun 阅读(797) 评论(0) 推荐(0)
摘要:题目链接 Code: 1 #include <bits/stdc++.h> 2 3 using namespace std; 4 5 6 const int N=301; 7 int n; 8 int grid[N][N]; 9 int expx[N]; 10 int expy[N]; 11 int 阅读全文
posted @ 2020-02-02 09:22 feibilun 阅读(119) 评论(0) 推荐(0)