1 #include <bits/stdc++.h>
2 using namespace std;
3
4 const int maxn=20+5,maxm=30+5,maxq=1e6;
5 const double eps=1e-8;
6 int c,n;
7 double ans;
8 inline int dcmp(double x){ if(fabs(x)<eps) return 0; else return x>0?1:-1; }
9 struct pt{
10 double x,y;
11 pt(double x=0,double y=0):x(x),y(y){}
12 pt operator + (const pt &a) const { return pt(x+a.x,y+a.y); }
13 pt operator - (const pt &a) const { return pt(x-a.x,y-a.y); }
14 pt operator * (const double &p) const { return pt(x*p,y*p); }
15 pt operator / (const double &p) const { return pt(x/p,y/p); }
16 pt normal(){ return pt(-y,x); }
17 bool operator == (const pt &a) const { return !dcmp(x-a.x)&&!dcmp(y-a.y); }
18 void read(){ scanf("%lf%lf",&x,&y); }
19 }A[maxn];
20 typedef pt vt;
21 inline double dot(vt a,vt b){ return a.x*b.x+a.y*b.y; }
22 inline double crs(vt a,vt b){ return a.x*b.y-a.y*b.x; }
23 inline double len(vt a){ return sqrt(dot(a,a)); }
24 struct sg{
25 pt a,b;
26 sg(){}
27 sg(pt a,pt b):a(a),b(b){}
28 bool on(const pt &p){ return !dcmp(crs(a-p,b-p))&&dcmp(dot(a-p,b-p))<0; }
29 }q[maxq];
30 struct polygon{
31 int cnt; pt p[maxm];
32 bool in(const pt &a){
33 int wn=0;
34 for(int i=1;i<=cnt;i++){
35 if(sg(p[i],p[i%cnt+1]).on(a)) return true;
36 int k=dcmp(crs(p[i%cnt+1]-p[i],a-p[i]));
37 int d1=dcmp(p[i].y-a.y);
38 int d2=dcmp(p[i%cnt+1].y-a.y);
39 if(k>0&&d1<=0&&d2>0) wn++;
40 if(k<0&&d2<=0&&d1>0) wn--;
41 }
42 return wn;
43 }
44 }land[maxn];
45 struct node{
46 pt p; double d;
47 node(){}
48 node(pt p,double d):p(p),d(d){}
49 };
50 inline pt get_l_int(pt p,vt v,pt q,vt w){
51 vt u=p-q;
52 double t=crs(w,u)/crs(v,w);
53 return p+v*t;
54 }
55 inline node dis_to_sg(pt p,pt a,pt b){
56 vt v1=b-a,v2=p-a,v3=p-b;
57 if(dcmp(dot(v1,v2)<0)) return node(a,len(v2));
58 else if(dcmp(dot(v1,v3)>0)) return node(b,len(v3));
59 else return node(get_l_int(p,v1.normal(),a,v1),fabs(crs(v1,v2)/len(v1)));
60 }
61 inline node find(pt a){
62 node t; t.d=1<<27;
63 for(int i=1;i<=c;i++){
64 if(land[i].in(a)) return node(a,0);
65 for(int j=1;j<=land[i].cnt;j++){
66 node tmp=dis_to_sg(a,land[i].p[j],land[i].p[j%land[i].cnt+1]);
67 if(dcmp(tmp.d-t.d)<0) t=tmp;
68 }
69 }
70 ans=max(ans,t.d);
71 return t;
72 }
73 inline void init(){
74 scanf("%d%d",&c,&n);
75 for(int i=1;i<=n;i++) A[i].read();
76 for(int i=1;i<=c;i++){
77 scanf("%d",&land[i].cnt);
78 for(int j=1;j<=land[i].cnt;j++) land[i].p[j].read();
79 }
80 }
81 inline void solve(){
82 int L=0,R=0;
83 for(int i=1;i<n;i++) q[R++]=sg(A[i],A[i+1]);
84 while(L!=R){
85 sg t=q[L++]; if(L==maxq) L=0;
86 pt p1=find(t.a).p, p2=find(t.b).p,l=t.a,r=t.b,mid=(l+r)/2;
87 while(len(l-r)>1e-4){
88 mid=(l+r)/2;
89 if(len(mid-p1)<len(mid-p2)) l=mid;
90 else r=mid;
91 }
92 double tmp=min(len(mid-p1),len(mid-p2));
93 if(ans+0.0001<tmp){
94 q[R++]=sg(t.a,mid); if(L==maxq) L=0;
95 q[R++]=sg(mid,t.b); if(L==maxq) L=0;
96 }
97 }
98 printf("%.2lf\n",ans);
99 }
100 int main(){
101 init();
102 solve();
103 return 0;
104 }