
二分图
丰川样子小孩姐
阿里嘎多扩赛以马斯
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
【题解】LuoGu1963:[NOI2009]变换序列
原题传送门 对于每个位置,可以得到两个备选数字 从当前点向两个备选连边 跑二分图匹配即可 接下来解决字典序最小问题,根据匈牙利算法的特点,后面遍历到的会把前面的给顶掉,那么不妨倒着做二分图匹配,可以满足 Code: #include <bits/stdc++.h> #define maxn 10010 using namespace std; struct Edge{ int to,...原创 2019-09-08 15:56:32 · 199 阅读 · 0 评论 -
【题解】LuoGu1640:[SCOI2010]连续攻击游戏
原题传送门 初看没什么头绪 想到二分图 每个装备的两个值a,ba,ba,b向iii连边 跑二分图即可,一旦不能匹配就退出 Code: #include <bits/stdc++.h> #define maxn 1000010 using namespace std; struct Edge{ int to, next; }edge[maxn << 1]; int num,...原创 2019-09-22 20:11:55 · 247 阅读 · 0 评论 -
【题解】LuoGu2055:[ZJOI2009]假期的宿舍
原题传送门 很显然是一个二分图问题 只要想想如何连边 学生向自己的床连边 所有人向自己认识的学生的床连边 搞定 Code: #include <bits/stdc++.h> #define maxn 110 using namespace std; struct Edge{ int to, next; }edge[maxn * maxn]; int n, m, num, head...原创 2019-10-03 18:01:00 · 174 阅读 · 0 评论