題目大意就是最大點對距,最大點對距的兩端點一定是凸包頂點,所以找出形成凸包所需要的最少頂點,然後遍歷找出最大點對距。
對凸包演算法的詳細講解:
#include#include
using
namespace std;
struct point
;point vertex[500000],res[500000];
int cmp(const
void * a,const
void* b)
int cross(point p0,point p1,point p2)
int graham(int n)
len=top; res[++top]=vertex[n-2];
for(i=n-3;i>=0;i--)
return top-1;
}int dist(point p1,point p2)
int caculate(int n)
int main()
return
0;}
Poj2187 凸包求最大距離
凸包 暴力求解,注意n 0,和n 1的情況 include include include include include include include define maxn 50000 10 using namespace std typedef struct point point int ...
poj2187 凸包問題
pseudo code graham scan algorithm input a set of pointss select the rightmost lowest point p0 ins.sortsangularly about p0 as a center.for ties,discard...
poj2187 凸包直徑模板
include include include include using namespace std define inf 50005 struct node node point inf int n,s inf top double cross node a,node b,node c doub...