hdu3829(最大独立集)】的更多相关文章

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 题意:动物园有N只猫,M只狗,P个小孩.每个小孩都有自己喜欢的动物和讨厌的动物,如果他喜欢狗,那么就讨厌猫, 如果他讨厌狗,那么他就喜欢猫.某个小孩能开心,当且仅当他喜欢的动物留在动物园和讨厌的动物不在动物园里面. 现让管理员通过带走某些动物,问最多能使多少个孩子开心. 分析:为了让尽量多的孩子开心,那么要选出一个最大的集合里面的点没有矛盾,因此根据孩子之间有矛盾建边,然后选出最大独立集即可. 最大独立集=总结点-最大匹配数.因为拿整个二分图来求最大匹配,而不是具体…
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,…
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…
题目链接: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…
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…
题目链接:https://vjudge.net/problem/HDU-3829 题目大意: 有\(P\)个小孩,\(N\)只猫,\(M\)只狗.每个小孩都有自己喜欢的某一只宠物和讨厌的某一只宠物(其中必定一只是猫,一只是狗),如果某个小孩喜欢的宠物被留下,而讨厌的宠物被带走,则这个小孩就会很开心.问要留下哪些宠物才能使得开心的小孩最多,求出这个最多的数量. 知识点: 最大独立集 解题思路: 对于两个小孩,如果其中一个喜欢的宠物刚好是另一个讨厌的宠物,那么这两个小孩不能一起开心.将不能一起开心的…
Kindergarten Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 4903   Accepted: 2387 Description In a kindergarten, there are a lot of kids. All girls of the kids know each other and all boys also know each other. In addition to that, some…
4316: 小C的独立集 Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 57  Solved: 41[Submit][Status][Discuss] Description 图论小王子小C经常虐菜,特别是在图论方面,经常把小D虐得很惨很惨. 这不,小C让小D去求一个无向图的最大独立集,通俗地讲就是:在无向图中选出若干个点,这些点互相没有边连接,并使取出的点尽量多. 小D虽然图论很弱,但是也知道无向图最大独立集是npc,但是小C很仁慈的给了一个很…
题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=26913 思路:水题一枚,就是求最大独立集.最大独立集=顶点数-最大匹配. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<vector> using namespace std; #define M…