博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[bzoj1185] [HNOI2007]最小矩形覆盖
阅读量:4349 次
发布时间:2019-06-07

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

  旋(xuàn)转(zhuàn)卡(kǎ)壳(qiào)(大雾

  抄了黄学长的标程当板子。。

  求凸包后,两对平行线卡来卡去..上下一对的直接用单峰性质,左右一对的也是...就看到底边的投影长,这个用数量积除以底边长。

1 #include
2 #include
3 #include
4 #include
5 #include
6 #define ll long long 7 #define d double 8 using namespace std; 9 const int maxn=52333;10 const d eps=1e-8;11 struct P{12 d x,y;13 }a[maxn],st[maxn],t[4];int tp;14 int i,j,k,n,m;15 int next[maxn];16 d ans=1e60;17 18 P operator +(P a,P b){
return (P){a.x+b.x,a.y+b.y};}19 P operator -(P a,P b){
return (P){a.x-b.x,a.y-b.y};}20 P operator *(P a,d b){
return (P){a.x*b,a.y*b};}21 22 d operator ^(P a,P b){
return a.x*b.y-b.x*a.y;}23 d operator *(P a,P b){
return a.x*b.x+a.y*b.y;}24 25 26 27 bool operator <(P a,P b){
return fabs(a.y-b.y)
'9')rx=getchar();33 while(rx>='0'&&rx<='9')ra*=10,ra+=rx-48,rx=getchar();return ra;34 }35 36 d dis(P a){ return sqrt(a.x*a.x+a.y*a.y);}37 inline void calc(){38 int l=1,r=1,p=1,i;39 d L,R,D,H,tmp;40 P now;41 for(i=0;i
(now^(st[p]-st[i]))-eps )p=next[p];46 while( now*(st[r+1]-st[i]) > now*(st[r]-st[i])-eps )r=next[r];47 if(!i)l=r;48 while( now*(st[l+1]-st[i]) < now*(st[l]-st[i])+eps )l=next[l];49 // printf(" %d %d %d\n",l,r,p);50 L=now*(st[l]-st[i])/D,R=now*(st[r]-st[i])/D,51 H=fabs( (now^(st[p]-st[i]))/D );52 // printf(" %.2lf %.2lf %.2lf %.2lf\n",L,R,H,D);53 tmp=(R-L)*H;54 if(tmp
=eps;66 }67 inline void graham(){68 register int i;69 for(i=2;i<=n;i++)if(a[i]
1&&((st[tp]-st[tp-1])^(a[i]-st[tp]))
View Code

 

转载于:https://www.cnblogs.com/czllgzmzl/p/5644752.html

你可能感兴趣的文章
mac 下编译 yasm
查看>>
socket创建UDP服务端和客户端
查看>>
Spring笔记--0907
查看>>
ArcGIS Engine中添加点、线、面元素
查看>>
SQL Server 2012安装时如何不安装自带的Visual Studio
查看>>
js判断图片上传格式
查看>>
网络传输协议总结(转载)
查看>>
C#.NET 大型企业信息化系统集成快速开发平台 4.2 版本 - 角色权限的配置页面改进优化...
查看>>
如何编写Spring-Boot自动配置
查看>>
(三)Asp.net web api中的坑-【http post请求中的参数】
查看>>
洛谷跑路
查看>>
使用DbProviderFactories.GetFactory方法需要配置数据库提供者
查看>>
Ubuntu || LinuxMint 配置apache虚拟主机
查看>>
HTML—链接
查看>>
将进程设置为守护进程
查看>>
用连接池提高Servlet访问数据库的效率
查看>>
luogu P1494 [国家集训队]小Z的袜子 ( 普 通 )
查看>>
树的数据结构
查看>>
MyEclipse导入Color Theme
查看>>
Vue开发微信H5 微信分享签名失败问题解决方案
查看>>