【BZOJ 1185】 凸包+旋转卡壳】的更多相关文章

题目大意 在某块平面土地上有N个点,你可以选择其中的任意四个点,将这片土地围起来,当然,你希望这四个点围成 的多边形面积最大. 分析 枚举对角线的一个端点 另一个端点开始转 转的时候求出对角线左边面积最大的三角形,右边面积最大的三角形 三角形面积\(=\)对角线长度\(*\)高 高\(=\)两条平行线间任意两点距离 过对角线做两条平行线,对着凸包夹一夹 可以发现这实际上就是一个旋转卡壳 \(O(n^2)\) solution #include <cstdio> #include <cst…
http://poj.org/problem?id=2187 题意:老题了,求平面内最远点对(让本渣默默想到了悲剧的AHOI2012……) 分析: nlogn的凸包+旋转卡壳 附:http://www.cppblog.com/staryjy/archive/2009/11/19/101412.html 旋转卡壳的…
题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=17267 [思路] 凸包+旋转卡壳 求出凸包,用旋转卡壳算出凸包的直径即可. [代码] #include<cstdio> #include<vector> #include<iostream> #include<algorithm> using namespace std; struct Pt { int x,y; Pt(,):…
题面 传送门 题解 以下记\(S_i=\{1,2,3,...,i\}\) 我们先用凸包+旋转卡壳求出直径的长度,并记直径的两个端点为\(i,j\)(如果有多条直径随机取两个端点) 因为这个序列被\(random\_shuffle\)过,有\(E(\max(i,j))=O({2\over 3}n)\),即\(\max(i,j)\)的较大值的期望是\(O({2\over 3}n)\).证明如下 \[ \begin{aligned} E(\max(i,j)) &={1\over n^2}\sum_{k…
Triangle Time Limit: 3000MS   Memory Limit: 30000KB   64bit IO Format: %I64d & %I64u Submit Status Description English Vietnamese Given n distinct points on a plane, your task is to find the triangle that have the maximum area, whose vertices are from…
D - Beauty Contest Time Limit:3000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Description Bessie, Farmer John's prize cow, has just won first place in a bovine beauty contest, earning the title 'Miss Cow World'. As a r…
思路: 求个凸包 旋转卡壳一下 就求出来最远点对了 注意共线情况 也就是说   凸包如果有一堆点共线保留端点即可 //By SiriusRen #include <cmath> #include <cstdio> #include <algorithm> using namespace std; ; ,ans; struct P{int x,y;P(){}P(int X,int Y){x=X,y=Y;}}p[N],tb[N]; bool cmp(P a,P b){ret…
题目链接:https://www.lydsy.com/JudgeOnline/problem.php?id=1185 题意: 给出二维平面上的n个点,问你将所有点覆盖的最小矩形面积. 题解: 先找出凸包,然后旋转卡壳. 在旋转卡壳中有一个结论:最小覆盖矩形一定有一条边在凸包上. 所以先枚举矩形在凸包上的那条边(p[i],p[i+1]),然后利用单调性找出p[i]的对踵点p[u]. 至于左右两侧的切点p[l]和p[r],要利用它们连线在直线(p[i],p[i+1])上投影长度的单调性求出. 最后将…
题目大意 用最小矩形覆盖平面上所有的点 分析 有一结论:最小矩形中有一条边在凸包的边上,不然可以旋转一个角度让面积变小 简略证明 我们逆时针枚举一条边 用旋转卡壳维护此时最左,最右,最上的点 注意 注意凸包后点数不再是n 吐槽 凸包后点数是n,bzoj上就过了??? solution #include <cstdio> #include <cstdlib> #include <cstring> #include <cctype> #include <c…
因为凸壳上对踵点的单调性所以旋转卡壳线性绕一圈就可以啦啦啦--- 先求凸包,然后旋转卡壳记录$sum1$和$sum2$,最后统计答案就可以了 #include<cmath> #include<cstdio> #include<cstring> #include<algorithm> #define read(x) x=getint() #define N 2003 using namespace std; inline int dcmp(double x)…