二分图
LOI_pingxing
这个作者很懒,什么都没留下…
展开
-
[codevs1069]关押罪犯 二分图染色
题目←思路: 既然说不用并查集来贪……那二分答案吧Orz 然后就没有了 注意这里二分的是数组下标,L永远指向不可能值,而又因为冲突是可能不产生的,所以L初始应在-1上代码:#include<iostream> #include<cstdio> #include<algorithm> #include<queue> using namespace std; const int MAXN = 10原创 2017-10-20 19:01:44 · 342 阅读 · 0 评论 -
[hdu5285]wyh2000 and pupil
题目←二分图判定+贪心 对每个联通块内的黑白点数进行统计,将个数较多的累加到ans1中 需特判两个情况: 1、点数 < 2,此时一定无法分成点数均 >= 1的两组 2、没有边,此刻若按上述方法贪心,会出现第二组个数为零的情况 也就是说m == 0和ans2 == 0只需要判一个就好了#include<iostream> #include<cstdio> #include<queue> #i原创 2017-10-20 20:57:01 · 226 阅读 · 0 评论 -
[洛谷P2055]假期的宿舍
题目←存一波匈牙利板子 check数组还是老老实实for一遍更新吧,回溯的时候更新容易出事//:-) #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #define LL long long using namespace std; const int MAXN = 1000 + 50; int n原创 2017-11-06 20:59:11 · 378 阅读 · 0 评论