此题就是求最大匹配.不过需要判断是否构成二分图.判断的方法是人选一点标记为红色(0),与它相邻的点标记为黑色(1),产生矛盾就无法构成二分图.声明一个vis[],初始化为-1.通过深搜,相邻的点不满足异或关系就结束.如果没被标记,就标记为相邻点的异或. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<queue> using na…
题目来源:HDU 2444 The Accomodation of Students 题意:n个人能否够分成2组 每组的人不能相互认识 就是二分图判定 能够分成2组 每组选一个2个人认识能够去一个双人间 最多能够有几组 思路:二分图判定+最大匹配 #include <cstdio> #include <cstring> #include <vector> using namespace std; const int maxn = 550; int vis[maxn];…
http://acm.hdu.edu.cn/showproblem.php?pid=2444 The Accomodation of Students Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 2444 Description There are a group of students. Some of them may know…
The Accomodation of Students Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Problem Description There are a group of students. Some of them may know each other, while others don't. For example, A and B know each o…
The Accomodation of Students Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3775    Accepted Submission(s): 1771 Problem Description There are a group of students. Some of them may know each ot…
The Accomodation of Students Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 7086    Accepted Submission(s): 3167 Problem Description There are a group of students. Some of them may know each o…
The Accomodation of StudentsTime Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8939    Accepted Submission(s): 3925 Problem DescriptionThere are a group of students. Some of them may know each othe…
The Accomodation of Students Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3565    Accepted Submission(s): 1659 Problem Description There are a group of students. Some of them may know each ot…
题目链接 题意:n个学生,m对关系,每一对互相认识的能住一个房间.问否把这些学生分成两组,要求每组的学生都互不认识.求最多须要多少个房间. 能否分成两组?也就是说推断是不是二分图,推断二分图的办法,用染色法 把初始点染成黑色,然后与之相连的染成白色,反复,使路径黑白相间, 假设当前点的颜色和与他相连点的颜色同样时,则说明这个图不是二分图 求最多须要多少个房间?也就是求最大匹配数. #include <iostream> #include <cstdio> #include <…
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=2444 Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Problem Description There are a group of students. Some of them may know each other, while others don't. For ex…