POJ 2239】的更多相关文章

1.poj 2239   Selecting Courses   二分图最大匹配问题 2.总结:看到一个题解,直接用三维数组做的,很巧妙,很暴力.. 题意:N种课,给出时间,每种课在星期几的第几节课上,求最多可上几种课. #include<iostream> #include<cstring> #include<cstdio> using namespace std; ][][]; ][],pipei[][]; int findn(int n) { ;i<=;i+…
poj——2239   Selecting Courses Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10656   Accepted: 4814 Description It is well known that it is not easy to select courses in the college, for there is usually conflict among the time of the c…
http://poj.org/problem?id=2239 这里要处理的是构图问题p (1 <= p <= 7), q (1 <= q <= 12)分别表示第i门课在一周的第p天的第q节课上 其中二分图的X集合里表示课程i,那么我们要解决的就是Y集合了 将第i门课在一周的第p天的第q节课上进行编号,这样Y集合就是 上课时间的编号了 #include<stdio.h> #include<string.h> #include<math.h> #in…
题目地址:http://poj.org/problem?id=2239 Li Ming大学选课,每天12节课,每周7天,每种同样的课可能有多节分布在不同天的不同节.问Li Ming最多可以选多少节课.把n种课划分为X集合,把一周的84节课划分为Y集合, 从Xi向Yi连边,那么就转化成了求二分图的最大匹配数,然后匈牙利算法就可以了. #include<cstdio> #include<iostream> #include<string.h> #include<alg…
Selecting Courses Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8316   Accepted: 3687 Description It is well known that it is not easy to select courses in the college, for there is usually conflict among the time of the courses. Li Mi…
二分图的最大匹配.课程和时间可以看做二分图. #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> using namespace std; ; int nx,ny; int g[MAXN][MAXN]; int cx[MAXN],cy[MAXN]; int mk[MAXN]; int n; ]; int path(int u) { ; v<ny; v++) { i…
呃呃呃呃呃 把每个课给了INF个容量....我是沙雕把....emm....这题就是做着玩...呃呃呃别当真.... #include <iostream> #include <cstdio> #include <sstream> #include <cstring> #include <map> #include <cctype> #include <set> #include <vector> #inclu…
#include<iostream> #include<algorithm> #define MAXN 305 using namespace std; int _m[MAXN][MAXN]; ][]; int match[MAXN]; bool ck[MAXN]; bool search(int a,int b,int x) { int i; int t; ; i < b ; i++) if (_m[x][i] && ! ck[i]) { ck[i] = t…
思路:最大匹配 也是很裸的一道题-. // by SiriusRen #include <cstdio> #include <cstring> #include <algorithm> using namespace std; #define N 500 int n,tot=0,first[N],v[N*N],next[N*N],jy,xx,yy,ans=0,vis[N],fa[N]; void add(int x,int y){v[tot]=y,next[tot]=f…
Selecting Courses Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 9380   Accepted: 4177 Description It is well known that it is not easy to select courses in the college, for there is usually conflict among the time of the courses. Li Mi…