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…
此题就是求最大匹配.不过需要判断是否构成二分图.判断的方法是人选一点标记为红色(0),与它相邻的点标记为黑色(1),产生矛盾就无法构成二分图.声明一个vis[],初始化为-1.通过深搜,相邻的点不满足异或关系就结束.如果没被标记,就标记为相邻点的异或. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<queue> using na…
题目链接 题意:n个学生,m对关系,每一对互相认识的能住一个房间.问否把这些学生分成两组,要求每组的学生都互不认识.求最多须要多少个房间. 能否分成两组?也就是说推断是不是二分图,推断二分图的办法,用染色法 把初始点染成黑色,然后与之相连的染成白色,反复,使路径黑白相间, 假设当前点的颜色和与他相连点的颜色同样时,则说明这个图不是二分图 求最多须要多少个房间?也就是求最大匹配数. #include <iostream> #include <cstdio> #include <…
题目来源: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 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 other, B and C know each other. But this may not imply t…
题目大意:有一群人他们有一些关系,比如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…