COURSES---poj1469 hdu1083(最大匹配)】的更多相关文章

COURSES Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 17777   Accepted: 7007 Description Consider a group of N students and P courses. Each student visits zero, one or more than one courses. Your task is to determine whether it is poss…
Courses Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5414    Accepted Submission(s): 2600 Problem Description Consider a group of N students and P courses. Each student visits zero, one or…
题目链接 N节课,每节课在一个星期中的某一节,求最多能选几节课 好吧,想了半天没想出来,最后看了题解是二分图最大匹配,好弱 建图: 每节课 与 时间有一条边 #include <iostream> #include <cstdio> #include <cmath> #include <cstring> #include <algorithm> #include <vector> using namespace std; + ; in…
主题链接: http://poj.org/problem?id=2239 题目大意: 学校总共同拥有N门课程,而且学校规定每天上12节可,一周上7天. 给你每门课每周上的次数,和哪一天哪一节 课上的.假设有多门课程在同一天同一节课上.那么你仅仅能选择当中一门.那么问题来了:最多能同一时候选多少 门课而不发生冲突呢. 输入说明: 先给你一个N.表示有N门课.接下来N行,每行第一个数字x,表示这门课每周上几节.接下来是x对数.第 一个数D表示是这一周哪一天上的,第二个数C表示是这一天哪一节课上的.…
Description Consider a group of N students and P courses. Each student visits zero, one or more than one courses. Your task is to determine whether it is possible to form a committee of exactly P students that satisfies simultaneously the conditions:…
题意: P门课,N个学生.     (1<=P<=100    1<=N<=300) 每门课有若干个学生可以成为这门课的代表(即候选人). 又规定每个学生最多只能成为一门课的代表(即要专一). 问是否存在一种安排方案使得每门课都有代表. 思路: 二分图最大匹配经典,,看代码. 代码: int T,n,p; vector<int> graph[505]; bool bmask[505]; int cx[505],cy[505]; int findPath(int u){…
题目链接:https://vjudge.net/problem/HDU-1083 Courses Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 8869    Accepted Submission(s): 4319 Problem Description Consider a group of N students and P c…
题目链接:https://cn.vjudge.net/problem/HDU-1083 题意 有一些学生,有一些课程 给出哪些学生可以学哪些课程,每个学生可以选多课,但只能做一个课程的代表 问所有课能否全部都有代表? 思路 二分图最大匹配问题 一个学生只能匹配一个课程,那么X部是学生,Y部是课程 求最大匹配即可 注意 二分图复杂度O(E*V) 邻接矩阵里G[a][b], a属于X部,b属于Y部,这是俩图所以ab节点的id可以相同 初始化match和vis 提交过程 AC 模版题 代码 #incl…
传送门:hdu2063过山车 #include <cstdio> #include <cstring> #include <string> #include <cmath> #include <iostream> #include <algorithm> #include <queue> #include <cstdlib> #include <stack> #include <vector&…
原文链接http://www.cnblogs.com/zhouzhendong/p/8232649.html 题目传送门 - POJ1469 题意概括 在一个大矩阵中,有一些障碍点. 现在让你用1*2的小矩形覆盖非障碍点,要求不覆盖到障碍点并且不重复覆盖,问是否可以覆盖所有非障碍点. 题解 本题几乎是裸题. 首先注意读入的表示障碍点的二元组(x,y)中y是行,x是列. 这个毒性深重<差评> 然后考虑算法.读者可以参考笔者的前一篇博客. 对于相邻的非障碍点我们来回都建边.然后我们给原图按照到某一…