题意 :给你一个小岛,是一个凸多边形,问你这个多边形的内部的点到所有边的最小值最大。
题解 :对于最小值最大的问题,不难想到要用二分去做,不难发现这个题的距离是满足二分性质的,然后将每天边向内部缩 dist 怎么缩呢 ? (通过一天边旋转90 度 就可以了) 。由于这个题给你的是一个凸多边形所以剩下的就可以用半平面交解决了,如果半平面交存在,那么这个答案检验就是可以的。
emmm……. 剩下的就是半平面交的模版了。
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#define PI 3.1415926
using namespace std;
#define N 1005
const double eps=1e-8;
int dcmp(double x) {
if (x<=eps&&x>=-eps) return 0;
return (x>0)?1:-1;
}
struct Vector {
double x,y;
Vector(double X=0,double Y=0){
x=X,y=Y;
}
};
typedef Vector Point;
struct Line {
Point p;
Vector v;
double ang;
Line(Point P=Point(0,0),Vector V=Vector(0,0)) {
p=P,v=V;
ang=atan2(v.y,v.x);
}
bool operator < (const Line &a) const {
return ang<a.ang;
}
};
Vector operator + (Vector a,Vector b) {
return Vector(a.x+b.x,a.y+b.