博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
HDU(3605),二分图多重匹配
阅读量:6910 次
发布时间:2019-06-27

本文共 1552 字,大约阅读时间需要 5 分钟。

题目链接:

Escape

Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)

Total Submission(s): 8944    Accepted Submission(s): 2084

Problem Description
2012 If this is the end of the world how to do? I do not know how. But now scientists have found that some stars, who can live, but some people do not fit to live some of the planet. Now scientists want your help, is to determine what all of people can live in these planets.
 
Input
More set of test data, the beginning of each data is n (1 <= n <= 100000), m (1 <= m <= 10) n indicate there n people on the earth, m representatives m planet, planet and people labels are from 0. Here are n lines, each line represents a suitable living conditions of people, each row has m digits, the ith digits is 1, said that a person is fit to live in the ith-planet, or is 0 for this person is not suitable for living in the ith planet.
The last line has m digits, the ith digit ai indicates the ith planet can contain ai people most..
0 <= ai <= 100000
 
Output
Determine whether all people can live up to these stars
If you can output YES, otherwise output NO.
 
Sample Input
1 1 1 1 2 2 1 0 1 0 1 1
 
Sample Output
YES NO
 
Source
 
题意:N(N<100,000)个人要去M(M<10)个星球,每个人只可以去一些星球,一个星球最多容纳Ki个人,输出是否所有人都可以选择自己的星球。
 
此题数据绝对很水,我不小心把写成match[][15]这都能过,哈哈哈。
多重匹配转换为最大匹配,把n个容量拆成n个点。
#include 
#include
int n,m;int maps[100010][15];int match[15][100010];int cnt[15];bool use[15];int cap[15];bool DFS(int u){ for(int i=0; i

 

 
 

转载于:https://www.cnblogs.com/TreeDream/p/5763824.html

你可能感兴趣的文章
转:【高并发简单解决方案】redis缓存队列+mysql 批量入库+php离线整合
查看>>
列表和屏幕的相互调用之从列表调用屏幕
查看>>
loadrunner-2-13错误处理函数
查看>>
C# 中的 App.config 文件配置
查看>>
LeetCode 队列与BFS--岛屿的数量
查看>>
jmeter-noguimodel
查看>>
Git使用++
查看>>
[C++]基本类型转换
查看>>
清除windows系统垃圾文件简易脚本(bat)
查看>>
Android WindowManager实现悬浮窗效果 (一)——与当前Activity绑定
查看>>
陶哲轩实分析 定理7.5.1 (方根判别法) 证明
查看>>
The direct sum of functions
查看>>
《Linux内核设计与实现》读书笔记(十五)- 进程地址空间(kernel 2.6.32.60)
查看>>
python实战===2017年30个惊艳的Python开源项目 (转)
查看>>
TurnipBit:和孩子一起动手DIY“滚动”的生日礼物
查看>>
删除一个链表中的重复元素
查看>>
C# 在多线程环境中,进行安全遍历操作
查看>>
Win7 防护墙设置——Ping命令,Http访问
查看>>
是男人就下100层【第一层】——高仿微信界面(6)
查看>>
day16- re模块(正则表达式 三种查找方法findall search match)
查看>>