UVA1194

POJ1325

POJ要多判一个非零!!!

#include<cstdio>
#include<vector>
#include<cstring>
using namespace std;
vector<int>e[105];
int vis[105];
int link[105];
int t;
int find(int x)
{
for(int i=0;i<e[x].size();i++)
{
int y=e[x][i];
if(vis[y]!=t)
{
vis[y]=t;
if(link[y]==0||find(link[y]))
{
link[y]=x;
return 1;
}
}
}
return 0;
}
int main()
{
int n,m,k;
while(scanf("%d%d%d",&n,&m,&k)==3&&n!=0)
{
memset(link,0,sizeof(link));
memset(vis,0,sizeof(vis));
t=0;
for(int i=1;i<=100;i++)
e[i].clear(); int num,x,y;
for(int i=1;i<=k;i++)
{
scanf("%d%d%d",&num,&x,&y);
if(x&&y)
e[x].push_back(y);
}
int ans=0;
for(int i=1;i<=n;i++)
{
t++;
if(find(i))
{
ans++;
}
//else
//break;
}
printf("%d\n",ans);
}
return 0;
}

Machine Schedule为什么UVA过了POJ过不了的更多相关文章

  1. POJ 1325 Machine Schedule——S.B.S.

    Machine Schedule Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 13731   Accepted: 5873 ...

  2. poj 1325 Machine Schedule 二分匹配,可以用最大流来做

    题目大意:机器调度问题,同一个任务可以在A,B两台不同的机器上以不同的模式完成.机器的初始模式是mode_0,但从任何模式改变成另一个模式需要重启机器.求完成所有工作所需最少重启次数. ======= ...

  3. Machine Schedule POJ - 1325(水归类建边)

    Machine Schedule Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 17457   Accepted: 7328 ...

  4. poj 1325 Machine Schedule 题解

    Machine Schedule Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 14479   Accepted: 6172 ...

  5. HDU - 1150 POJ - 1325 Machine Schedule 匈牙利算法(最小点覆盖)

    Machine Schedule As we all know, machine scheduling is a very classical problem in computer science ...

  6. POJ 1325 && 1274:Machine Schedule 匈牙利算法模板题

    Machine Schedule Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 12976   Accepted: 5529 ...

  7. hdu 1150 Machine Schedule 最少点覆盖转化为最大匹配

    Machine Schedule Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php? ...

  8. Machine Schedule

    Machine Schedule Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) ...

  9. hdu-----(1150)Machine Schedule(最小覆盖点)

    Machine Schedule Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) ...

随机推荐

  1. 学习Electorn(1)——Hello World

    环境 操作系统是Manjaro kde 18.01 按照官网文档:https://electronjs.org/docs 安装node https://nodejs.org/en/download/p ...

  2. msyql 去重

    delete from userinfo where busi_id in (select busi_id from (select busi_id from userinfo group by bu ...

  3. 深度挖坑:从数据角度看人脸识别中Feature Normalization,Weight Normalization以及Triplet的作用

    深度挖坑:从数据角度看人脸识别中Feature Normalization,Weight Normalization以及Triplet的作用 周翼南 北京大学 工学硕士 373 人赞同了该文章 基于深 ...

  4. CMake入门-01-从HelloWorld开始

    工作环境 系统:macOS Mojave 10.14.6 CMake: Version 3.15.0-rc4 从 Hello,World! 开始 (1) 新建 hello 目录,创建文件 CMakeL ...

  5. (二十二)SpringBoot之使用Druid连接池以及SQL监控和spring监控

    一.引入maven依赖 <dependencies> <dependency> <groupId>org.springframework.boot</grou ...

  6. C语言并查集例子——图问题巧用parent[]数组

    输入:测试输入包含若干测试用例.每个测试用例的第1行给出两个正整数,分别是城镇数目N ( < 1000 )和道路数目M:随后的M行对应M条道路,每行给出一对正整数,分别是该条道路直接连通的两个城 ...

  7. leetcode-3 最长无重复字串

    3. Longest Substring Without Repeating Characters 题面 Given a string, find the length of the longest ...

  8. EBS R12.2系统logo的修改

    https://blog.csdn.net/lzl1101206656/article/details/74171999 EBS系统logo的修改 转载lzl1101206656 发布于2017-07 ...

  9. python数据写入Excel表格

    from openpyxl import Workbook def main(): sheet_name = "表名1" row_count = 6 # 行数 info_resul ...

  10. shell 数组介绍

    平时的定义a=1;b=2;c=3,变量如果多了,再一个一个定义很繁琐,并且取变量值也很累.简单的说,数组就是各种数据类型的元素按一定顺序排列的集合. 数组就是把有限个元素变量或数组用一个名字命名,然后 ...