dp+ mathematical expectation of the shape pressure
Konjac Konjac not ... See the problem run ...
Orz a bit hzwer, found himself now is really too water, do not look at the problem of a question will not catch it?
The problem data range is not big ... 100* (2^16) is easy to run over ...
DP when Max is not connected to the current K-treasure ... Divide by N at the end (count expectations)
1 /**************************************************************2 problem:10763 User:tunix4 language:c++5 result:accepted6 time:1336 Ms7 memory:52984 KB8 ****************************************************************/9 Ten //Bzoj 1076 One#include <cstdio> A#include <cstdlib> -#include <cstring> -#include <iostream> the#include <algorithm> - #defineRep (i,n) for (int i=0;i<n;++i) - #defineF (i,j,n) for (int i=j;i<=n;++i) - #defineD (i,j,n) for (int i=j;i>=n;--i) + using namespacestd; - + intGetint () { A intv=0, sign=1;CharCh=GetChar (); at while(ch<'0'|| Ch>'9') {if(ch=='-') sign=-1; Ch=GetChar ();} - while(ch>='0'&&ch<='9') {v=v*Ten+ch-'0'; Ch=GetChar ();} - returnv*=Sign ; - } - /*******************tamplate********************/ - Const intn=101, m= (1<< -); in DoubleF[n][m]; - intw[ -],d[ -],n,k; to intMain () { + //freopen ("Input.txt", "R", stdin); -K=getint (); n=getint (); the intT; *F (I,1, N) { $w[i]=getint ();Panax Notoginsengt=getint (); - while(t) {d[i]|=1<< (t1); t=getint ();} the } +D (I,k,1) ARep (J,1<<N) { theF (k,1, N) + if((d[k]&j) = =D[k]) -F[i][j]+=max (f[i+1][j],f[i+1][j| (1<< (K-1))]+w[k]); $ Elsef[i][j]+=f[i+1][j]; $F[i][j]/=N; - } -printf"%.6LF", f[1][0]); the return 0; -}View Code
"Bzoj" "1076" "SCOI2008" reward off