hdu1068 Girls and Boys --- 最大独立集】的更多相关文章

有一个集合男和一个集合女,给出两集合间一些一一相应关系.问该两集合中的最大独立集的点数. 最大独立集=顶点总数-最大匹配数 此题中.若(a,b)有关.则(b,a)有关.每个关系算了两次,相当于二分图的两边集合没有分男女.两边都是总人数. 所以此题中答案应该是 顶点总数-最大匹配数/2 #include<cstdio> #include<cstring> #include<cmath> #include<iostream> #include<algori…
Girls and BoysTime Limit: 20000/10000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 13556    Accepted Submission(s): 6385 Problem Descriptionthe second year of the university somebody started a study on the romanti…
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1068 二分图的最大独立集数=节点数(n)— 最大匹配数(m) 另外需要注意的是: 本题求出的最大匹配数是实际的两倍需要m/2 #include<iostream> #include<stdio.h> #include<math.h> #include<string.h> #include<stdlib.h> using namespace std; ;…
HDU 1068 :题目链接 题意:一些男孩和女孩,给出一些人物关系,然后问能找到最多有多少个人都互不认识. 转换一下:就是大家都不认识的人,即最大独立集合 #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> #include <math.h> #define init(a) memset(a,…
题目链接: 二分匹配的应用 求最大独立集 最大独立集等于=顶点数-匹配数 本体中由于男孩和女孩的学号是不分开的,所以匹配数应是求得的匹配数/2 代码: #include<iostream> #include<cstdlib> #include<cstring> #include<cstdio> using namespace std; #define maxn 500 int g[maxn][maxn]; int vis_x[maxn]; int vis_y…
#include <cstdio> #include <algorithm> #include <cstring> #include <vector> using namespace std; ; vector<int>map[maxn]; bool mark[maxn]; int link[maxn]; int n; void init(){ ; i <= n; i++){ map[i].clear(); } memset(mark, f…
#include <cstdio> #include <cstring> #include <algorithm> #include <cstdlib> using namespace std; #define MAXN 500 int map[MAXN][MAXN]; int mark[MAXN]; int pipei[MAXN]; int n; int search(int a) { ; i < n; i++) { if (map[a][i] &a…
Girls and Boys Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) [Problem Description] the second year of the university somebody started a study on the romantic relations between the students. The relation “romant…
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: 20000/10000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 8470    Accepted Submission(s): 3890 Problem Description the second year of the university somebody started a study on the romant…