题目大意:一共有N个学生跟P门课程,一个学生可以任意选一门或多门课,问是否达成: 1.每个学生选的都是不同的课(即不能有两个学生选同一门课) 2.每门课都有一个代表(即P门课都被成功选过) 输入为: P N(课程数跟学生数) 接着有P行,格式为Count studenti studenti+1 --studentcount (Count表示对课程1感兴趣的学生数,接着有Count个学生) 如第一行3 1 2 3表示学生1跟学生2跟学生3对课程1感兴趣 输出为: 若能满足上面两个要求这输出"YES…
The Perfect Stall Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 20874   Accepted: 9421 Description Farmer John completed his new barn just last week, complete with all the latest milking technology. Unfortunately, due to engineering pr…
二分图:https://blog.csdn.net/c20180630/article/details/70175814 https://blog.csdn.net/flynn_curry/article/details/52966283 匈牙利算法模板:https://blog.csdn.net/sunny_hun/article/details/80627351 例题:hdu 1150 Machine Schedule 参考:https://www.cnblogs.com/qq-star/p…
匈牙利算法是由匈牙利数学家Edmonds于1965年提出,因而得名.匈牙利算法是基于Hall定理中充分性证明的思想,它是部图匹配最常见的算法,该算法的核心就是寻找增广路径,它是一种用增广路径求二分图最大匹配的算法. 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=2063 题目大意: 中文题目,点进去马上知道. 解题思路: 这道题目就是求最大匹配数目,直接套用匈牙利算法模板,这个算法大概原则就是:有机会上,没有机会创造机会也要上. 代码: #inc…
匈牙利 算法 一. 算法简介 匈牙利算法是由匈牙利数学家Edmonds于1965年提出.该算法的核心就是寻找增广路径,它是一种用增广路径求二分图最大匹配的算法. 二分图的定义: 设G=(V,E)是一个无向图,顶点集V可分割为两个互不相交的子集V1,V2,那么称此图G为二分图. 例如,下图就是一个二分图: 二分图的匹配: 二分图中的子图中,每个节点只连一条边,则称该子图是二分图中的一个匹配. 极大匹配: 无法再向二分图中加入边,使得满足匹配条件. 最大匹配: 所有极大匹配中边数最多的一个匹配. 完…
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=1045 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Problem Description Suppose that we have a square city with straight streets. A map of a city is a square board…
题目链接: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…
传送门:http://poj.org/problem?id=3041 Asteroids Time Limit: 1000MS Memory Limit: 65536K Description Bessie wants to navigate her spaceship through a dangerous asteroid field in the shape of an N x N grid (1 <= N <= 500). The grid contains K asteroids (…
Machine Schedule Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 12976   Accepted: 5529 Description As we all know, machine scheduling is a very classical problem in computer science and has been studied for a very long history. Scheduli…
http://poj.org/problem?id=1469 COURSES Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 19419   Accepted: 7642 Description Consider a group of N students and P courses. Each student visits zero, one or more than one courses. Your task is…