#include #include #include #include #include #include using namespace std; #define left Left #define right Right #define eps 1e-8 #define maxn 60000 double x[maxn],y[maxn],r[maxn]; int left[maxn],right[maxn],up[maxn],rank_up[maxn]; int n; set my_set; double mid; bool cmp_left(const int &a,const int &b) { return x[a]-r[a] < x[b]-r[b]; } bool cmp_right(const int &a,const int &b) { return x[a]+r[a] < x[b]+r[b]; } bool cmp_up(const int &a,const int &b) { if(y[a]==y[b]) return x[a] < x[b]; else return y[a] < y[b]; } double my_sqr(double a) { return a*a; } bool is_cross(int a,int b) { a=up[a],b=up[b]; double t1,t2; t1=my_sqr(x[a]-x[b])+my_sqr(y[a]-y[b]),t2=my_sqr(r[a]+r[b]+mid+mid); if(t1<=t2) return true; return false; } bool insert(int a) { set::iterator it=my_set.insert(a).first; if(it!=my_set.begin()) { if(is_cross(a,*--it)) return true; it++; } if(++it!=my_set.end()) { if(is_cross(a,*it)) return true; } return false; } bool is_ok() { my_set.clear(); int i=0,j=0; while(i