题意:在某块平面土地上有N个点,你可以选择其中的任意四个点,将这片土地围起来,当然,你希望这四个点围成. 的多边形面积最大.n<=2000. 先求凸包,再枚举对角线,随着对角线的斜率上升,另外两个点的在凸包上的位置也是单调的. 水平扫描法:先将所有点按x排序,然后从左往右边扫边求出上凸壳,然后从右往左扫出下凸壳.最后会发现a[tot]=a[1]. #include<cstdio> #include<algorithm> #define rep(i,l,r) for (int…
思路: 求凸包: 先按照x轴排个序 从左往右扫一遍 找到上凸壳 (用叉积) 再从右往左扫一遍 求下凸壳 搞个旋转卡壳就好啦~ 嗯 我手懒 用的C++ Complex库 巨好用! //By SiriusRen #include <cstdio> #include <complex> #include <algorithm> using namespace std; #define Cplexd complex<double> int n,q[4444]; do…
题目链接:https://vjudge.net/problem/POJ-1113 题意:简化下题意即求凸包的周长+2×PI×r. 思路:用graham求凸包,模板是kuangbin的. AC code: #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> using namespace std; ; const double PI=acos(-1.0); struct…
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…
在某块平面土地上有N个点,你可以选择其中的任意四个点,将这片土地围起来,当然,你希望这四个点围成的多边形面积最大. 题解:先求出凸包,O(n)枚举旋转卡壳,O(n)枚举另一个点,求最大四边形面积 /************************************************************** Problem: 1069 User: walfy Language: C++ Result: Accepted Time:892 ms Memory:1360 kb ****…