hdu 题目1150 Machine Schedule(最小点覆盖)
来源:互联网 发布:残留webshell 编辑:程序博客网 时间:2024/05/16 07:00
http://acm.hdu.edu.cn/showproblem.php?pid=1150
没有考虑从0号开始o(╯□╰)o,但是AC了,最小点覆盖,工作看做边,A的模式为X点集合, B的模式为Y点集合,
需要用最少的点,做完所有工作(关联到所有边),即最小点覆盖
还有,题目上没说x,y的范围。(如果就是0,1,2,3,....)的话,只要判断link[y]是否为0即可,如果有的话,一开始处于0模式不用转换。。。,
/***************************# 2013-9-3 13:34:42 # Time: 0MS Memory: 240K# Author: zyh# Status: Accepted***************************/ #include<stdio.h>#include<string.h>#define N 105int m,n;bool G[N][N],vis[N];int link[N];bool dfs(int x){for(int i=1;i<=m;i++){if(G[x][i]&&!vis[i]){vis[i]=1;if(link[i]==-1 || dfs(link[i])){link[i]=x;return 1;}}}return 0;}int main(){int sum,x,y,i,k;while(scanf("%d",&n),n){memset(G,0,sizeof(G));memset(link,-1,sizeof(link));scanf("%d%d",&m,&k); while(k--){scanf("%d%d%d",&i,&x,&y);G[x][y]=1;}for(sum=0,i=1;i<=n;i++){memset(vis,0,sizeof(vis));if(dfs(i)) sum++;}printf("%d\n",sum);}return 0;}
- hdu 题目1150 Machine Schedule(最小点覆盖)
- HDU 1150 Machine Schedule 最小点覆盖
- hdu 1150 Machine Schedule ( 最小点覆盖 )
- hdu 1150 Machine Schedule (最小点覆盖)
- HDU 1150 Machine Schedule (最小点覆盖)
- hdu 1150 Machine Schedule(最小点覆盖)
- HDU 1150 Machine Schedule(最小点覆盖)
- hdu 1150 Machine Schedule 最小点覆盖
- hdu 1150 最小点覆盖 Machine Schedule
- HDU 1150 Machine Schedule(最小点覆盖问题)
- HDU 1150 Machine Schedule(最小点覆盖) 二分匹配
- HDU 1150 Machine Schedule(最小点覆盖)
- HDU 1150 Machine Schedule(最小点覆盖)
- HDU 1150 -- Machine Schedule (最小点覆盖)
- HDU 1150 Machine Schedule(最小点覆盖)
- hdu 1150 Machine Schedule(求最小点覆盖)
- HDU 1150 Machine Schedule (二分图最小点覆盖)
- hdu 1150 Machine Schedule (最小覆盖)
- vi的语法高亮和背景颜色设置
- Java常用加密算法工具类
- jbpm4以jpdl字符串发布流程 出现com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException 错误
- Minigui学习--光标
- HQL 查询多对多 注意
- hdu 题目1150 Machine Schedule(最小点覆盖)
- redmine backlogs time entry功能
- Highcharts是一个制作图表的纯Javascript类库
- 简单的tomcat内存监控报警
- 区间dp-zoj3541-The Last Puzzle
- HDU3208(区间指数和)
- Olldbg常见问题
- IRQ_BALANCE的CPU亲和性设置
- 详解Android中的屏幕方向