void minball(int n, point pt[]) { ball(); if (outCnt < 4) for (int i = 0; i < n; ++i) if ((res - pt[i]).norm() > +radius + EPS) { out[outCnt] = pt[i]; ++outCnt; minball(i, pt); --outCnt; if (i > 0) { point Tt = pt[i]; memmove(&pt[1], &pt[0], sizeof(point) * i); pt[0] = Tt; } } }
void minball(int n) { ball(); if( nouter<4 ) for(int i=0; i<n; ++i) if( dist(res, point[i])-radius>eps ) { outer[nouter]=point[i]; ++nouter; minball(i); --nouter; if( i>0 ) { point_type Tt = point[i]; memmove(&point[1], &point[0], sizeof(point_type)*i); point[0]=Tt; } } }
pair<point, double> main(int npoint, point pt[]) { // 0-based random_shuffle(pt, pt + npoint); radius = -1; for (int i = 0; i < npoint; i++) { if ((res - pt[i]).norm() > EPS + radius) { outCnt = 1; out[0] = pt[i]; minball(i, pt); } } return make_pair(res, sqrt(radius)); }