感觉题目考察的有些偏;
满中国oj都见不到类似的(晚半年的吐槽。。。。)
其实掌握了相关知识还是很裸的;
#define rep(i,k,n) for(int i=k;i<=n;i++)
#define rep2(i,k,n) for(int i=k;i>=n;i--)
using namespace std;
typedef double db;
const int N=73;
const db pi=acos(-1.0);
struct P{db x,y,z;
P(db x=0.0,db y=0.0,db z=0.0):x(x),y(y),z(z){}
void in(){scanf("%lf%lf%lf",&x,&y,&z);}
}node[N],cen;
db operator^(const P& a,const P& b){return a.x*b.x+a.y*b.y+a.z*b.z;}
P operator*(const P& a,const P& b){return P(a.y*b.z-a.z*b.y,a.z*b.x-a.x*b.z,a.x*b.y-a.y*b.x);}
P operator*(const P& a,db b){return P(a.x*b,a.y*b,a.z*b);}
P operator/(const P& a,db b){return P(a.x/b,a.y/b,a.z/b);}
P operator+(const P& a,const P& b){return P(a.x+b.x,a.y+b.y,a.z+b.z);}
P operator-(const P& a,const P& b){return P(a.x-b.x,a.y-b.y,a.z-b.z);}
db lenth(const P& a){return sqrt(a^a);}
struct F{
int num;
P p[N];
}f[N];
int n,m;
P get_c4(const P& a,const P& b,const P& c,const P& d){
P res=P(0,0,0);
res=res+a;res=res+b;res=res+c;res=res+d;
return res/4.0;
}
db get_v(const P& k,const P& a,const P& b,const P& c){
P l=b-a,r=c-a,h=k-a;
return fabs((l*r)^h)/6.0;
}
void get_cen(){cen=P(0,0,0);
rep(i,1,n)cen=cen+node[i];
cen=cen/(n*1.0);
db sum=0.0;P ne=P(0,0,0);
rep(i,1,m){
int cc=f[i].num;
rep(j,2,cc-1){
db res=get_v(cen,f[i].p[1],f[i].p[j],f[i].p[j+1]);
P c4=get_c4(cen,f[i].p[1],f[i].p[j],f[i].p[j+1]);
sum+=res;
ne=ne+(c4*res);
}
}ne=ne/sum;
cen=ne;
}
db get_sq(const P& a,const P& b,const P& c){
P r1 = (a - cen)*(b - cen);r1 = r1 / lenth(r1);
P r2 = (b - cen)*(c - cen);r2 = r2 / lenth(r2);
P r3 = (c - cen)*(a - cen);r3 = r3 / lenth(r3);
db ang1 = pi-acos(r1 ^ r2);
db ang2 = pi-acos(r2 ^ r3);
db ang3 = pi-acos(r1 ^ r3);
return ang1 + ang2 + ang3 - pi;
}
void go(){db sum=4*pi;
rep(i,1,m){
db res=0;
int cc=f[i].num;
rep(j,2,cc-1){
res+=get_sq(f[i].p[1],f[i].p[j],f[i].p[j+1]);
}printf("%.7lf\n",res/sum);
}
}
int main(){
scanf("%d%d",&n,&m);
rep(i,1,n)node[i].in();int x;
rep(i,1,m){scanf("%d",&f[i].num);
rep(j,1,f[i].num){scanf("%d",&x);f[i].p[j]=node[x];}
}
get_cen();
go();
return 0;
}