POJ 2187 凸包+旋转卡壳】的更多相关文章

思路: 求个凸包 旋转卡壳一下 就求出来最远点对了 注意共线情况 也就是说   凸包如果有一堆点共线保留端点即可 //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…
求平面最远点对 #include<iostream> #include<cstdio> #include<algorithm> #include<cmath> using namespace std; const int N=50005; int n,w=1,top; double ans; struct dian { double x,y; dian(double X=0,double Y=0) { x=X,y=Y; } dian operator + (…
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…
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…
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…
Poj 2187 凸包模板求解 传送门 由于整个点数是50000,而求凸包后的点也不会很多,因此直接套凸包之后两重循环即可求解 #include <queue> #include <cmath> #include <cstdio> #include <cstring> #include <cstdlib> #include <iostream> #include <algorithm> #define ll long lo…
题目链接:http://poj.org/problem?id=2187 旋转卡壳算法:http://www.cppblog.com/staryjy/archive/2009/11/19/101412.html 或 http://cgm.cs.mcgill.ca/~orm/rotcal.frame.html #include<cstdio> #include<cstring> #include<cmath> #include<iostream> #includ…
题目链接:http://poj.org/problem?id=2187 Time Limit: 3000MS Memory Limit: 65536K 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 result, Bessie will make a tour of…