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: 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…
题意:给出每个学生的标号及与其有缘分成为情侣的人的标号,求一个最大集合,集合中任意两个人都没有缘分成为情侣. 分析: 1.若两人有缘分,则可以连一条边,本题是求一个最大集合,集合中任意两点都不相连,即最大独立集问题. 2.最大独立集 = 顶点数 - 最大匹配数(匈牙利算法求解). 3.将一个人拆成两个相同的人进行二分匹配,因此真正的最大匹配数应为得到的最大匹配数/2. #pragma comment(linker, "/STACK:102400000, 102400000") #inc…
题目大意:第一行输入一个整数n,表示有n个节点.在接下来的n行中,每行的输入数据的格式是: 1: (2) 4 6 :表示编号为1的人认识2个人,他们分别是4.6: 求,最多能找到多少个人,他们互不认识 解题思路:二分图的最大独立集. 1)最大独立集 =  节点数 - 最大匹配数/2: 2)令女生数= 男生数 = 总数 3)   1: (2)可以采用scanf("%d: (%d)",&a,&b);来输入 代码如下: /* * 1068_1.cpp * * Created…
#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…
Girls and Boys Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 7044    Accepted Submission(s): 3178 Problem Description the second year of the university somebody started a study on the roman…
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…
匈牙利算法,最开始暴力解不知道为什么就是wa,后来明白,一定要求最优解.查了一下匈牙利算法相关内容,大致了解. #include <stdio.h> #include <string.h> #define MAXNUM 505 int map[MAXNUM][MAXNUM]; int visit[MAXNUM]; int link[MAXNUM]; int dfs(int x, int n) { int i; ; i<n; ++i) { && map[x][i…
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://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…