#include #include #include #include #include #include const int MAX_P = 500+5; struct Dir{ int x,y; }; struct Edge{ int s,e; double dis; bool operator<(const Edge that)const { return this->dis < that.dis; } }edges[MAX_P*MAX_P]; int s,p; Dir dirs[MAX_P]; decltype(Edge::dis) square(const decltype(Edge::dis) &n){ return n*n; } int check_sets[MAX_P]; int find_set(const int n){ if(check_sets[n]==n){ return n; }else{ check_sets[n] = find_set(check_sets[n]); } return check_sets[n]; } void merge_set(const int a,const int b){ check_sets[find_set(a)] = check_sets[find_set(b)]; } int main(){ std::cin.sync_with_stdio(false),std::cin.tie(0),std::cout.tie(0); std::cin>>s>>p; for(int i=1;i<=p;i++){ check_sets[i]=i; } for(int i=1;i<=p;i++){ std::cin>>dirs[i].x>>dirs[i].y; } int flag = -1; for(int i=1;i<=p;i++){ for(int j=i+1;j<=p;j++){ flag++; edges[flag].e=i,edges[flag].s=j,edges[flag].dis=std::sqrt(square(dirs[i].x-dirs[j].x)+square(dirs[i].y-dirs[j].y)); } } std::sort(edges,edges+flag+1); decltype(Edge::dis) ans{0}; // #define NV(v)std::cout<<#v<<" : "<<(v)<<"\n"; #define NV(v) int cnt{0}; for(int i=0;i=p-s){ std::cout<