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) ...
随机推荐
- 【BFS】Help the Princess!
题目描述 The people of a certain kingdom make a revolution against the bad government of the princess. T ...
- Tomcat与WAS应用中间件差异化分析研究
--转载 http://blog.chinaunix.net/uid-25723371-id-5759072.html 目前我们在使用的基于JAVA的提供逻辑展现应用中间件有两种,一种是以商用软件WA ...
- SpringMVC 出现 406(Not Acceptable)
首先,需要清楚,http state 406代表什么意思: 406是HTTP协议状态码的一种,表示无法使用请求的特性来响应请求的网页.一般指客户端浏览器不接受所请求页面的MIME类型. 出现这样的错误 ...
- Javascript--HTML DOM基础知识
1.HTML DOM是什么,以及它的作用: w3c对DOM有一系列的解释和定义,用自己理解的话来说就是:HTML DOM是html的标准对象模型,可以使JavaScript去操作(获取,修改,删除,添 ...
- java如何在不访问数据库就可以对list分页?
废话不多说,直接上代码 import java.util.ArrayList; import java.util.List; public class demo { public static voi ...
- 配置Python、Django环境变量教程
配置环境变量 在Windows下你必须配置环境变量! 右击桌面或者你能看到的任何 此电脑.这台电脑或者我的电脑. 右击:属性 点击:高级系统设置 点击:环境变量 找到系统变量下的Path,双击 点击新 ...
- Sliverlight/WPF 样式使用方法
1,UserControl 页面级样式: UserControl.Resources style setter Property value. TargetType为应用的类型 <UserCon ...
- I2C总线、设备、驱动
I2C总线.设备.驱动 框架 I2C驱动框架可分为3个部分,分别是:I2C核心层.I2C总线驱动层(适配器层)以及I2C设备驱动层: I2C核心层 提供了统一的I2C操作函数,主要有两套函数smbus ...
- python3 基础二——基本的数据类型一
一.基本的数据类型 Python3 中有六个标准的数据类型Number(数字). String(字符串). List(列表) .Tuple(元组). Sets(集合) .Dictionary(字典) ...
- spring实例化二:SimpleInstantiationStrategy
spring对类的实例化,定义了接口InstantiationStrategy,同时先做了个简单实现类SimpleInstantiationStrategy.采用实现部分,抽象部分的策 ...