The Accomodation of Students (二分匹配)
来源:互联网 发布:传奇斗笠数据库代码 编辑:程序博客网 时间:2024/05/30 04:30
The Accomodation of Students
Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 15 Accepted Submission(s): 12Problem 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 that A and C know each other.
Now you are given all pairs of students who know each other. Your task is to divide the students into two groups so that any two students in the same group don't know each other.If this goal can be achieved, then arrange them into double rooms. Remember, only paris appearing in the previous given set can live in the same room, which means only known students can live in the same room.
Calculate the maximum number of pairs that can be arranged into these double rooms.
Now you are given all pairs of students who know each other. Your task is to divide the students into two groups so that any two students in the same group don't know each other.If this goal can be achieved, then arrange them into double rooms. Remember, only paris appearing in the previous given set can live in the same room, which means only known students can live in the same room.
Calculate the maximum number of pairs that can be arranged into these double rooms.
Input
For each data set:
The first line gives two integers, n and m(1<n<=200), indicating there are n students and m pairs of students who know each other. The next m lines give such pairs.
Proceed to the end of file.
The first line gives two integers, n and m(1<n<=200), indicating there are n students and m pairs of students who know each other. The next m lines give such pairs.
Proceed to the end of file.
Output
If these students cannot be divided into two groups, print "No". Otherwise, print the maximum number of pairs that can be arranged in those rooms.
Sample Input
4 41 21 31 42 36 51 21 31 42 53 6
Sample Output
No3
Source
2008 Asia Harbin Regional Contest Online
题意:先判断是否是二分图,然后求最大匹配
一个匈牙利算法 + dfs判断二分图
阅读全文
0 0
- The Accomodation of Students (二分匹配)
- hdu2444 二分匹配 The Accomodation of Students
- hdu The Accomodation of Students(二分匹配)
- hdu 2444-The Accomodation of Students(二分匹配)
- hdu2444 The Accomodation of Students(判断二分匹配+最大匹配)
- hdu 2444 The Accomodation of Students 二分匹配
- hdu 2444 The Accomodation of Students 二分匹配
- hdu2444 The Accomodation of Students (二分图判断+最大匹配)
- hdu 2444 The Accomodation of Students (交叉染色+二分匹配)
- 【HDU】2444 The Accomodation of Students 二分匹配
- hdu 2444The Accomodation of Students 二分匹配+dfs分组
- hdu2444 The Accomodation of Students(判联通+二分匹配)
- 【二分匹配】 HDU 2444 The Accomodation of Students
- HDU2444 The Accomodation of Students(二分匹配 匈牙利算法)
- hdu 2444 The Accomodation of Students(二分匹配)
- HDU2444 The Accomodation of Students 染色+二分匹配
- hdu2444 The Accomodation of Students【二分图判断+最大匹配】
- HDU 2444 The Accomodation of Students 二分匹配
- CentOS设置打开终端快捷键
- MongoDB集群部署:Replic Set + Sharding
- 每日一题(21)——malloc与free(二)
- VC下线程同步的四种方法详解
- 做一个优秀的java程序员
- The Accomodation of Students (二分匹配)
- tensorflow读取数据-tfrecord格式
- MongoDB备份-mongodump和恢复-mongorestore
- 第一次用博客
- 大暑假集训 第一阶段总结 233
- 查看光口的状态命令
- CentOS初始设置
- Ubuntu16.04+CUDA8.0+cudnn5.1+TensorFlow-GPU详细安装步骤
- Linux下的scp命令