Machine Schedule为什么UVA过了POJ过不了
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过不了的更多相关文章
- POJ 1325 Machine Schedule——S.B.S.
Machine Schedule Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 13731 Accepted: 5873 ...
- poj 1325 Machine Schedule 二分匹配,可以用最大流来做
题目大意:机器调度问题,同一个任务可以在A,B两台不同的机器上以不同的模式完成.机器的初始模式是mode_0,但从任何模式改变成另一个模式需要重启机器.求完成所有工作所需最少重启次数. ======= ...
- Machine Schedule POJ - 1325(水归类建边)
Machine Schedule Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 17457 Accepted: 7328 ...
- poj 1325 Machine Schedule 题解
Machine Schedule Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 14479 Accepted: 6172 ...
- HDU - 1150 POJ - 1325 Machine Schedule 匈牙利算法(最小点覆盖)
Machine Schedule As we all know, machine scheduling is a very classical problem in computer science ...
- POJ 1325 && 1274:Machine Schedule 匈牙利算法模板题
Machine Schedule Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 12976 Accepted: 5529 ...
- hdu 1150 Machine Schedule 最少点覆盖转化为最大匹配
Machine Schedule Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php? ...
- Machine Schedule
Machine Schedule Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- hdu-----(1150)Machine Schedule(最小覆盖点)
Machine Schedule Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
随机推荐
- maftools | 从头开始绘制发表级oncoplot(瀑布图)
本文首发于微信公众号 **“ 生信补给站 ”** ,期待您的关注!!! 原文链接:https://mp.weixin.qq.com/s/G-0PtaoO6bYuhx_D_Rlrlw 对于组学数据的分析 ...
- 多节点bigchaindb集群部署
文章比较的长,安装下来大概4个小时左右,我个人使用的服务器,速度会快一点. 安装环境 ostname ip os node-admin 192.168.237.130 ubuntu 18.04.2 d ...
- SQL Server 2017 左补齐
DECLARE @NUM CHAR(3)='7 'SELECT RIGHT('0000000'+CONVERT(VARCHAR(50),1+ RTRIM(@NUM)),7)
- EF中DbContext的生命周期
/// <summary>/// 依赖注入系统中类的生命周期./// </summary>public enum DependencyLifeStyle{ /// < ...
- 【转载】salesforce 零基础开发入门学习(五)异步进程介绍与数据批处理Batchable
salesforce 零基础开发入门学习(五)异步进程介绍与数据批处理Batchable 本篇知识参考:https://developer.salesforce.com/trailhead/for ...
- from表单中checkbox的多选,ajax转入后台,后台接受
var check = [];//定义一个空数组 $("input[name='category']:checked").each(function(i){//把所有被选中的复选框 ...
- liunx shell 脚本的基础知识
Shell脚本编程30分钟入门====================## 什么是Shell脚本### 示例看个例子吧: #!/bin/sh cd ~ mkdir shell_tut cd shell ...
- MyBatis工厂工具类 MyBatisUtils
import org.apache.ibatis.io.Resources; import org.apache.ibatis.session.SqlSession; import org.apach ...
- Hadoop集群搭建(cluster setup),ssh免密后一直要求输入密码的原因
前段时间,网上有言SHA-1加密技术,已经被谷歌公司破解,在linux系统中,集群间加密的技术是用DSA秘钥,秘钥本身其实是一种算法,就像前面说的SHA-1也是加密算法的一种. 免密在linux系统中 ...
- django 新项目
1.创建虚拟环境 mkvirtualenv - p python3 2.pycharm : 在pycharm中新建项目, 取名.添加虚拟机上的虚拟环境