/* Author: Modan Han This solution was written by the one of the ACPC judges. Feel free to discuss it in the CPC discord. (discord.gg/MEXwfze) ---------------------------------------------------------------------*/ #include using namespace std; const double EP = 1e-9; // do not use for angles typedef complex PX; const PX BAD(1e100,1e100); double cp(PX a, PX b) {return (conj(a)*b).imag();} double dp(PX a, PX b) {return (conj(a)*b).real();} bool ss(PX a, PX b) {return fabs(cp(a,b)) < EP;} struct arc{ PX p,b,e;double r; }; typedef pair ls; typedef vector vls; int n,q; vls lss; vector arcs; // Can be used to check if a point is on a line (0) int ccw(PX a, PX b, PX c) { double r = cp(b-a, c-a); if (fabs(r) < EP) return 0; return r > 0 ? 1 : -1; } PX lineIntersect(PX p1, PX v1, PX p2, PX v2) { // If exact same line, pick random point (p1) if (ss(v1, v2)) return ss(v1, p2-p1) ? p1 : BAD; return p1 + (cp(p2-p1,v2)/cp(v1,v2))*v1; } double p2ls(PX p, ls l){ double l2=norm(l.second-l.first); if(l2>n>>q; vector polygon; polygon.assign(n,PX(0,0)); vector smooth; smooth.assign(n,0); for(int i=0;i>x>>y; polygon[i]=PX(x,y); } lss.resize(n); for(int i=0;i>smooth[i]; for(int i=0;i0)rd*=-1; auto rp=pm+rd*r; arc a;a.p=rp;a.r=r;a.b=pm; { auto d1=pn-pc; d1/=abs(d1); auto pm1=pc+d1*smooth[i]; a.e=pm1; } arcs.push_back(a); } // for(auto a:arcs)cout<>x>>y; PX p(x,y); double ans=1e100; for(auto a:lss)ans=min(ans,p2ls(p,a)); for(auto a:arcs)ans=min(ans,p2a(p,a)); printf("%.6f\n",ans); } }