// sort by y boolcmpy(node qw,node er){ if(qw.y==er.y) return qw.x<er.x; return qw.y<er.y; } // count the distance between two points // name can not be distance, because there is a function named distance in cmath doubledis(node qw,node er){ returnsqrt((qw.x-er.x)*(qw.x-er.x)+(qw.y-er.y)*(qw.y-er.y)); }
int n; node temp[mxlen]; doublesolve(int l,int r){ if(l==r) return1e20; // if there are only two points if(l+1==r) returndis(points[l],points[r]); int mid = (l+r)>>1; double d = min(solve(l,mid),solve(mid+1,r));
// sort by y, otherwise the code will TLE int len = 1; for(int i=mid;i>=l&&points[mid].x-points[i].x<d;i--) temp[len++] = points[i]; for(int i=mid+1;i<=r&&points[i].x-points[mid].x<d;i++) temp[len++] = points[i]; sort(temp+1,temp+len,cmpy); for(int i=1;i<len;i++){ for(int j=i+1;j<len&&temp[j].y-temp[i].y<d;j++){ d = min(d,dis(temp[i],temp[j])); } } return d; } intmain(){ while(1){ scanf("%d",&n); if(!n) break; for(int i=1;i<=n;i++){ scanf("%lf%lf",&points[i].x,&points[i].y); } sort(points+1,points+n+1,cmpx); double ans = solve(1,n); printf("%.2f\n",ans/2); } return0; }