hdu3829】的更多相关文章

题目链接:https://vjudge.net/problem/HDU-3829 Cat VS Dog Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 125536/65536 K (Java/Others)Total Submission(s): 4118    Accepted Submission(s): 1493 Problem Description The zoo have N cats and M dogs, toda…
题目链接:https://vjudge.net/problem/HDU-3829 题目大意: 有\(P\)个小孩,\(N\)只猫,\(M\)只狗.每个小孩都有自己喜欢的某一只宠物和讨厌的某一只宠物(其中必定一只是猫,一只是狗),如果某个小孩喜欢的宠物被留下,而讨厌的宠物被带走,则这个小孩就会很开心.问要留下哪些宠物才能使得开心的小孩最多,求出这个最多的数量. 知识点: 最大独立集 解题思路: 对于两个小孩,如果其中一个喜欢的宠物刚好是另一个讨厌的宠物,那么这两个小孩不能一起开心.将不能一起开心的…
传送门:Cat VS Dog 题意:动物园有N只猫,M只狗,P个小孩.每个小孩都有自己喜欢的动物和讨厌的动物,如果他喜欢狗,那么就讨厌猫, 如果他讨厌狗,那么他就喜欢猫.某个小孩能开心,当且仅当他喜欢的动物留在动物园和讨厌的动物不在动物园里面. 现让管理员通过带走某些动物,问最多能使多少个孩子开心. 分析:为了让尽量多的孩子开心,那么要选出一个最大的集合里面的点没有矛盾,因此根据孩子之间有矛盾建边,然后选出最大独立集即可. 最大独立集=总结点-最大匹配数.因为拿整个二分图来求最大匹配,而不是具体…
The zoo have N cats and M dogs, today there are P children visiting the zoo, each child has a like-animal and a dislike-animal, if the child's like-animal is a cat, then his/hers dislike-animal must be a dog, and vice versa. Now the zoo administrator…
Cat VS Dog Problem Description The zoo have N cats and M dogs, today there are P children visiting the zoo, each child has a like-animal and a dislike-animal, if the child's like-animal is a cat, then his/hers dislike-animal must be a dog, and vice v…
Cat VS Dog Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 125536/65536 K (Java/Others)Total Submission(s): 4039    Accepted Submission(s): 1458 Problem Description The zoo have N cats and M dogs, today there are P children visiting the zoo,…
题解: 对于每一个孩子裂点+建边 如果i孩子讨厌的和j孩子喜欢的相同,那么建边 然后跑最大独立集 代码: #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> using namespace std; ; int fi[N],num,s1[N],s2[N],match[N],zz[N*N],ne[N*N],n,f[N]; void jb(int x,int y) { ne…
Cat VS Dog Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 125536/65536 K (Java/Others)Total Submission(s): 4751    Accepted Submission(s): 1757 Description: The zoo have N cats and M dogs, today there are P children visiting the zoo, each ch…
Cat VS Dog Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 125536/65536 K (Java/Others) Problem Description The zoo have N cats and M dogs, today there are P children visiting the zoo, each child has a like-animal and a dislike-animal, if the ch…
刚回到家 开了二分匹配专题 手握xyl模板 奋力写写写 终于写完了一群模板题 A hdu1045 对这个图进行 行列的重写 给每个位置赋予新的行列 使不能相互打到的位置 拥有不同的行与列 然后左行右列 边是新的坐标 求最大匹配 #include<stdio.h> #include<string.h> #include<algorithm> #include<math.h> #include<map> #include<string>…