POJ 1466 Girls and Boys】的更多相关文章

http://poj.org/problem?id=1466 Girls and Boys Time Limit: 5000MS   Memory Limit: 10000K Total Submissions: 11085   Accepted: 4956 Description In the second year of the university somebody started a study on the romantic relations between the students…
Girls and Boys Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://poj.org/problem?id=1466 Description In the second year of the university somebody started a study on the romantic relations between the students. The relation "romantically involved&q…
Girls and Boys Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://poj.org/problem?id=1466 Description In the second year of the university somebody started a study on the romantic relations between the students. The relation "romantically involved&q…
Girls and Boys Time Limit: 5000MS   Memory Limit: 10000K Total Submissions: 10912   Accepted: 4887 Description In the second year of the university somebody started a study on the romantic relations between the students. The relation "romantically in…
Girls and Boys Time Limit: 5000ms Memory Limit: 10000KB This problem will be judged on PKU. Original ID: 1466 64-bit integer IO format: %lld      Java class name: Main In the second year of the university somebody started a study on the romantic(浪漫的)…
链接:poj 1466 题意:有n个学生,每一个学生都和一些人有关系,如今要你找出最大的人数.使得这些人之间没关系 思路:求最大独立集,最大独立集=点数-最大匹配数 分析:建图时应该是一边是男生的点,一边是女生的点连边.可是题目中没说性别的问题.仅仅能将每一个点拆成两个点.一个当作是男的点,一个当作是女的点了,然后连边.因为关系是相互的.这样就造成了边的反复.也就是边集是刚才的二倍,从而导致了最大匹配变成了原本的二倍.因此,此时最大独立集=点数-最大匹配数/2. #include<stdio.h…
[题目链接] http://poj.org/problem?id=1466 [题目大意] 给出一些人和他们所喜欢的人,两个人相互喜欢就能配成一对, 问最后没有配对的人的最少数量 [题解] 求最少数量,就是最多匹配的补集,因此做一遍二分图匹配即可. [代码] #include <cstdio> #include <algorithm> #include <cstring> #include <vector> using namespace std; const…
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=137 http://poj.org/problem?id=1466 题目大意: n个学生,他们中有的有关系,有的没有关系,求最多可以取出几个人,使得他们之间没有关系. 思路: 复制别人的..... 最大独立集问题:在N个点的图G中选出m个点,使这m个点两两之间没有边.求m最大值.如果图G满足二分图条件,则可以用二分图匹配来做.最大独立集点数 = N - 最大匹配数/2,然后就是…
有n个人, 其中有男生和女生,接着有n行,分别给出了每一个人暗恋的对象(不止暗恋一个) 现在要从这n个人中找出一个最大集合,满足这个集合中的任意2个人,都没有暗恋这种关系. 输出集合的元素个数. 刚开始想,把人看成顶点,若有暗恋的关系,就连一条边,构成一个图 独立集的概念:一个图中两两互不相连的顶点集合 所以这道题,就是要求最大独立集 有:最大独立集+最小顶点覆盖=|V|(顶点的总个数) 那就求最小顶点覆盖了 根据题意: 暗恋的对象性别不同,所以a暗恋b,b暗恋c,c暗恋a这种关系不可能存在 也…
Description In the second year of the university somebody started a study on the romantic relations between the students. The relation "romantically involved" is defined between one girl and one boy. For the study reasons it is necessary to find…