1 #include <cstdio>
2 #include <cstring>
3 #include <cstdlib>
4 #include <iostream>
5 #include <algorithm>
6
7 const int MAXN=16;
8 const int MAXK=110;
9
10 int n;
11 int k;
12 double p;
13 int pre[MAXN];
14 double value[MAXN];
15 double dp[MAXK][1<<MAXN];
16
17 void Initialize();
18 void DynamicProgramming(int);
19
20 int main(){
21 Initialize();
22 for(int i=k;i>0;i--){
23 for(int j=0;j<(1<<n);j++){
24 for(int k=0;k<n;k++){
25 if((j&pre[k])==pre[k])
26 dp[i][j]+=std::max(dp[i+1][j|(1<<k)]+value[k],dp[i+1][j])/n;
27 else
28 dp[i][j]+=dp[i+1][j]/n;
29 }
30 }
31 }
32 printf("%.6lf\n",dp[1][0]);
33 return 0;
34 }
35
36 void Initialize(){
37 int a;
38 int b;
39 scanf("%d%d",&k,&n);
40 for(int i=0;i<n;i++){
41 scanf("%lf",value+i);
42 while(scanf("%d",&b),b!=0){
43 pre[i]|=(1<<(b-1));
44 }
45 }
46 p=1.0/n;
47 }