ZOJ3277 POJ3836 HDU3269 P2P File Sharing System,二分图匹配
来源:互联网 发布:2g和3g网络的区别 编辑:程序博客网 时间:2024/05/16 01:53
二分图匹配。不过这里要暴力枚举每一天的情况。
/******************************************************************************* # Author : Neo Fung # Email : neosfung@gmail.com # Last modified: 2012-05-23 20:59 # Filename: ZOJ3277 POJ3836 HDU3269 P2P File Sharing System.cpp # Description : ******************************************************************************/#ifdef _MSC_VER#define DEBUG#define _CRT_SECURE_NO_DEPRECATE#endif#include <fstream>#include <stdio.h>#include <iostream>#include <string.h>#include <string>#include <limits.h>#include <algorithm>#include <math.h>#include <numeric>#include <functional>#include <ctype.h>#define MAX 110using namespace std;bool map[MAX][MAX];//邻接矩阵bool used[MAX];//在每次找增广路径中用于记录当前节点是否在增广路径中int mat[MAX];//各个节点对应的匹配项int m,n,beg[MAX],end[MAX];bool task[MAX*MAX];bool find(const int &x)//从x开始是否有增广路{int i;for(i=1;i<=8;++i){if(map[x][i] && !used[i])//若x与i有边相连且i不在当前的增广路上{used[i]=1;if(!mat[i] || find(mat[i]))//若i没有匹配项或从i的匹配项开始有增广路{mat[i]=x;return true;}}}return false;}int main(void){#ifdef DEBUG freopen("../stdin.txt","r",stdin);freopen("../stdout.txt","w",stdout); #endif int tmp,var,ncase=1;scanf("%d",&ncase);while(ncase--){scanf("%d",&n);memset(map,0,sizeof(map));memset(task,0,sizeof(task));m=0;int finish=0,start=INT_MAX;for(int i=1;i<=n;++i){scanf("%d%d%d",&beg[i],&end[i],&var);finish=max(finish,end[i]);start=min(start,beg[i]);while(var--){scanf("%d",&tmp);map[i][tmp]=1;}}bool ans=true;for(int i=start;i<=finish && ans;++i){memset(mat,0,sizeof(mat));for(int j=1;j<=n && ans;++j)if(beg[j]<=i && end[j]>=i){memset(used,0,sizeof(used));if(!find(j))ans=false;}}if(ans)printf("YES\n");elseprintf("NO\n");}return 0;}
- ZOJ3277 POJ3836 HDU3269 P2P File Sharing System,二分图匹配
- HDU3269 P2P File Sharing System
- poj 3836 P2P File Sharing System
- HDU 3269 P2P File Sharing System 模拟
- Implement p2p file sharing system with RMI
- hdu 3269 P2P File Sharing System(大模拟)
- POJ 3836 P2P File Sharing System 模拟客户机和服务器P2P传输过程
- 文献笔记3-large scale analysis of the edonkey p2p file sharing system
- Create a P2P file-sharing application
- POJ 3894 System Engineer 二分图匹配 Hopcroft_Carp 最大流
- poj 3894 System Engineer (二分图最大匹配--匈牙利算法)
- Top 10 Most Popular P2P File Sharing Clients of 2010/2011
- Sharing The Application Tier File System in Oracle E-Business Suite Release 12.2
- Network File Sharing Services
- VBOX File sharing
- Sharing a File
- Sharing a File
- Setting Up File Sharing
- zend反编译-dezender 使用
- 精确获取时间(QueryPerformanceCounter)
- 霍夫曼编码压缩算法
- linux-3.2.18菜鸟的移植笔记
- PendingIntent 的用法
- ZOJ3277 POJ3836 HDU3269 P2P File Sharing System,二分图匹配
- sizeof()和lstrlen()和strlen()区别
- BlueTrip简明教程
- ibatIS打印SQL的log4j配置
- 位运算与嵌入式编程
- 简单工厂模式
- Spring如何加载XSD文件(org.xml.sax.SAXParseException: Failed to read schema document错误的解决方法)
- ExtJS中的GridPanel增删改查以及分页
- 对象与垃圾回收