题目
像平面最近点对那样分治,枚举点的时候大胆枚举,小心剪枝即可AC
AC Code:
#include<bits/stdc++.h>
#define maxn 200005
using namespace std;
int n;
int x[maxn],y[maxn],c[maxn];
double sqr(double a){
return a*a; }
double dist(int a,int b){
return sqrt(sqr(x[a]-x[b])+sqr(y[a]-y[b])); }
inline bool cmp1(const int &u,const int &v){
return x[u]<x[v]; }
//inline bool cmp2(const int &u,const int &v){ return y[u]<y[v]; }
double ans = 0x3f3f3f3f;