ZOJ 1364 Machine Schedule
来源:互联网 发布:三金西瓜霜漱口水 知乎 编辑:程序博客网 时间:2024/05/21 05:24
#include <iostream>#include <cstring>using namespace std;const int MAXN = 105;int xs[MAXN],ys[MAXN];int mk[MAXN];int nx, ny;int g[MAXN][MAXN];int path( int u ){ for(int v = 1; v <= ny; ++v) { if( g[u][v] && !mk[v] ) { mk[v] = 1; if( !ys[v] || path( ys[v] )) { xs[u] = v; ys[v] = u; return 1; } } } return 0;}int MaxMatch(){ int i, ans = 0; memset(xs, 0, sizeof(xs)); memset(ys, 0, sizeof(ys)); for(i = 1; i <= nx; ++i) { if( !xs[i] ) { memset(mk, 0, sizeof(mk)); ans += path( i ); } } return ans;}int main(){ int i, k; int a, b; int m; while(cin>>nx) { if(nx == 0) break; cin>>ny>>k; memset(g, 0, sizeof(g)); for(i = 1; i <= k; ++i) { cin>>m>>a>>b; g[a][b] = 1; } int ans = 0; ans = MaxMatch(); cout<<ans<<endl; } return 0;}/**5 5 100 1 11 1 22 1 33 1 44 2 15 2 26 2 37 2 48 3 39 4 30*/
- ZOJ 1364 Machine Schedule
- zoj 1364 || poj 1325 Machine Schedule
- poj 1325 | zoj 1364 Machine Schedule
- poj 1325 && zoj 1364 Machine Schedule
- ZOJ 1364 Machine Schedule(二分图最大匹配)
- POJ 1325、ZOJ 1364、HDU 1150 Machine Schedule - from lanshui_Yang
- POJ 1325 Machine Schedule(zoj 1364) 最小覆盖数
- ZOJ 1364 Machine Schedule(二分图最大匹配)
- ZOJ 1364 Machine Schedule (二分图最大匹配)
- ZOJ 1364 Machine Schedule (POJ 1325) (最小点覆盖数==最大匹配数)
- POJ 1325 && ZOJ 1364--Machine Schedule【二分图 && 最小点覆盖数】
- Machine Schedule
- Machine Schedule
- Machine Schedule
- Machine Schedule
- Machine Schedule
- Machine Schedule
- Machine Schedule
- phpmailer使用简介
- 浙大PAT advanced level 1003 emergency
- 内存管理之虚拟内存篇
- HDU 4165 Pills (dp解法)
- __asm__ __volatile__("": : :"memory")等系列问题
- ZOJ 1364 Machine Schedule
- UIView的AutoSizing
- 51单片机入门~chapter1
- 计算机网络基础
- w_文件流,缓冲流,二进制流复制文件哪个比较快!
- hdu 4746 Bell 中国剩余定理+矩阵乘法+第二类斯特林数 (2013网络赛)
- Linux Power Management for x86 CPU (1)---- C-State
- system32里的文件说明
- android小程序,根据生日年份计算出生肖