此题就是求最大匹配.不过需要判断是否构成二分图.判断的方法是人选一点标记为红色(0),与它相邻的点标记为黑色(1),产生矛盾就无法构成二分图.声明一个vis[],初始化为-1.通过深搜,相邻的点不满足异或关系就结束.如果没被标记,就标记为相邻点的异或. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<queue> using na…
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 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…
题目来源: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…
题目链接: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…
题目大意:有一群人他们有一些关系,比如A认识B, B认识C, 但是这并不意味值A和C认识.现在给你所有互相认识的学生,你的任务是把所有的学生分成两个一组, 住在一个双人房里.相互认识的同学可以住在一个双人房里. 输入数据: 有n个学生 m个关系(m对是相互认识的) 接下来m行是,是m个关系. 如果能够匹配成功则输出需要双人房的个数,否则输出'No'   思路:先判断是否是个二分图,可以使用黑白染色的方法来判断.然后再进行最大匹配.   #include<stdio.h> #include<…
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…
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=2444 题意:首先判断所有的人可不可以分成互不认识的两部分.如果可以分成 ,则求两部分最多相互认识的对数. 思路:二分图最大匹配问题.先BFS判断是否为二分图,再用匈牙利算法算最大匹配量 关于匈牙利算法:https://blog.csdn.net/CillyB/article/details/55511666 代码: #include<iostream> #include<cstdio>…