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. Python3 使用pygal 生成世界人口地图

    最近在看<python从入门到实践>,其中有一个例子是使用pygal制作世界人口地图,觉得挺有意思的,这里就记录下来了, 其实代码不是很复杂,使用环境环境python3.废话不多说,直接上 ...

  2. CI/CD/Jenkins

    Continuous Integration, Continuous Delivery & Deployment (CI/CD) 持续集成.持续部署&持续交付. Jenkins就是一个 ...

  3. ggplot2|详解八大基本绘图要素

    本文首发于微信公众号 *“ 生信补给站 ” ,期待您的关注!!!* 原文链接:https://mp.weixin.qq.com/s?__biz=MzIyNDI1MzgzOQ==&mid=265 ...

  4. 轻松搭建CAS 5.x系列文章

    轻松搭建CAS 5.x系列(1)-使用cas overlay搭建SSO SERVER服务端 轻松搭建CAS 5.x系列(2)-搭建HTTPS的SSO SERVER端 轻松搭建CAS 5.x系列(3)- ...

  5. (一)easyUI之树形网络

    树形网格(TreeGrid)可以展示有限空间上带有多列和复杂数据电子表 一.案例一:按tree的数据结构来生成 前台 <%@ page language="java" con ...

  6. (七)装配Bean(1)

    针对给接口提供哪一个具体的实现,也就是装配哪一种具体的实现bean,在Spring中提供了多种方式,主要包括3种: 一.隐式的bean发现机制和自动装配(自动化装配bean) 二.在Java类中进行显 ...

  7. (六)发送、接收SOAP消息(1)

    一.为什么要用soap 原本我们使用web服务都是根据wsdl生成客户端(生成一堆java文件)然后再调用,本章节讲解如何用soap消息来替代这种方式. 二.SOAP消息格式 SOAP(简单对象访问协 ...

  8. Django 配置JWT验证

    1.setting.py配置 REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': ( 'rest_framework_jwt.authentica ...

  9. 编译 recastnavigation

      1. https://github.com/memononen/recastnavigation 下载zip并解压 2. 打开https://www.libsdl.org/download-2.0 ...

  10. 更优雅地关闭资源 - try-with-resource及其异常抑制--转载

    原文地址:https://www.cnblogs.com/itZhy/p/7636615.html 一.背景 我们知道,在Java编程过程中,如果打开了外部资源(文件.数据库连接.网络连接等),我们必 ...