传送门
题意:
给你 200 200 200个圆,让你求出所有圆的凸包。
思路:
先把圆去重,然后把圆套圆中的小圆给去掉。
接着做出圆的两两公切点,丢掉所有在某个圆内部的点,然后做凸包即可。
计算长度时要判断是否在一个圆上,如果在上面要判优弧/劣弧,不在就直接加距离。
凸包求错导致调了 3 h 3h 3h的圆的部分硬是过不了。。。
代码:
#include<bits/stdc++.h>
#define ri register int
using namespace std;
const int rlen=1<<18|1;
inline char gc(){
static char buf[rlen],*ib,*ob;
(ib==ob)&&(ob=(ib=buf)+fread(buf,1,rlen,stdin));
return ib==ob?-1:*ib++;
}
inline int read(){
int ans=0;
bool f=1;
char ch=gc();
while(!isdigit(ch))f^=ch=='-',ch=gc();
while(isdigit(ch))ans=((ans<<2)+ans<<1)+(ch^48),ch=gc();
return f?ans:-ans;
}
typedef long double ld;
typedef long long ll;
const int N=2e6+5;
const ld eps=1e-8,pi=acos(-1.0);
inline int signal(const ld&x){
return (x>eps)-(x<-eps);}
struct pot{
ld x,y;
pot(ld x=0,ld y=0):x(x),y(y){
}
friend inline pot operator+(const pot&a,const pot&b){
return pot(a.x+b.x,a.y+b.y);}
friend inline pot operator-(const pot&a,const pot&b){
return pot(a.x-b.x,a.y-b.y);}
friend inline ld operator^(const pot&a,const pot&b){