博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
HLG 1481 Attack of the Giant n-pus【二分+二分图完全匹配】
阅读量:6982 次
发布时间:2019-06-27

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

题意: 有 p 个水手和一个章鱼,章鱼有 n 个脚,知道了所有单位的坐标,和船长以及船员的速度,船长想去攻击章鱼的头部,但是只有在章鱼所有的脚都被水手控制的情况下才会开始朝章鱼头部进攻,问如何分配水手控制的触须,才能在最短时间内是船长攻击到其头部。

分析: 二分枚举船员移动的时间ti, 如果水手与某个触须接触所要的时间小于 ti,就在该水手与该触须之间连一条边,找出满足水手与触须最大匹配等于 n 的最小时间,最后加上船长移动到章鱼头部需要的时间即为答案。

#include
#include
#include
#define clr(x)memset(x,0,sizeof(x))int link[102];bool v[102];struct p{ int to,next;}e[10002];struct node{ double x,y; double v;}te[102],pr[102],ca,he;int tot;int head[102];void add(int s,int u){ e[tot].to=u; e[tot].next=head[s]; head[s]=tot++;}int find(int x){ int i,k; for(i=head[x];i;i=e[i].next) { k=e[i].to; if(!v[k]) { v[k]=true; if(link[k]==0||find(link[k])) { link[k]=x; return 1; } } } return 0;}int n,p;double g[102][102];bool ok(double ti){ int i,j; tot=1; clr(head); clr(link); for(i=1;i<=p;i++) for(j=1;j<=n;j++) if(g[i][j]
high) high=g[i][j]; } while(low

 

转载于:https://www.cnblogs.com/dream-wind/archive/2012/07/23/2604649.html

你可能感兴趣的文章
Erlang 简易安装和卸载
查看>>
Windows Server 2012 R2 DirectAccess功能测试(3)—App2服务器安装及配置
查看>>
Shell 十三问学习笔记2
查看>>
Juniper-R&S-BGP(1):一些写在前头的基础知识
查看>>
python flaskfeng封装跨域请求头和封装json格式
查看>>
【搜索引擎基础知识2】网络爬虫
查看>>
Aptana Studio 3 汉化
查看>>
phonegap+jquerymobile开发android的心得(4)
查看>>
python 使用PyTesser--安装
查看>>
无需编译,1分钟安装Ubuntu官方构建的最新版Linux内核
查看>>
解压即用,Ubuntu上Nginx/Apache/PHP编译打包
查看>>
table设置border没有空隙
查看>>
Maven的setting.xml 配置详解
查看>>
Python3.7源码在windows(VS2015)下的编译和安装
查看>>
10_css选择符类型1.html
查看>>
修改 liteide 的 godoc 文档样式
查看>>
Java学习笔记(35)——Java集合07之TreeMap
查看>>
甲骨文推Oracle WebLogic应用服务器12c
查看>>
WEB服务器、应用程序服务器、HTTP服务器区别
查看>>
工厂方法
查看>>