[HAOI2015] [BZOJ4036] [Luogu P3175] bitwise or (Min-Max repudiation) (FMT)

BZOJ portal

Lough Valley Portal


First of all, the expectation problem related to binary bit is obviously to consider Min-Max exclusion.

The set of questions is obviously all binary bits.

So E(max (S) == T S(8722;1) 8721;T S(8722;1) 87878739 878739;+1E (min \(T)) \sum {T\subseteqS}(-1) ^{{{||+1} E (\min (T))) E(max (S) == T T ((;+1E(min(T))

Obviously, the earliest expected occurrence of elements in TTT sets is 1_U_T!= PU_dfrac{1} {sum limit_{U_capT!= empty} P_U} U_T!= PU_1

We need to find the sum of all PPP s that intersect with a set that is not empty.

It is transformed into finding the sum of all PPP s of a set intersecting with an empty set. It is found that all subsets of the set complement can be obtained by using the fast Mobius transformation directly.


#define ll long long
#define re register
#define gc get_char
#define cs const

namespace IO{
	inline char get_char(){
		static cs int Rlen=1<<22|1;
		static char buf[Rlen],*p1,*p2;
		return (p1==p2)&&(p2=(p1=buf)+fread(buf,1,Rlen,stdin),p1==p2)?EOF:*p1++;
	inline double getdb(){
		char c;
		while(!isdigit(c=gc()));double x=c^48;
		if(c!='.')return x;double y=1;
		return x;
using namespace IO;

using std::cerr;
using std::cout;

cs int N=1<<20|1;
double a[N];
int popcount[N];
signed main(){
#ifdef zxyoi
	int len;scanf("%d",&len);len=1<<len;int ok=0;
	for(int re i=0;i<len;++i)a[i]=getdb(),popcount[i]=popcount[i>>1]^(i&1);
	for(int re i=0;i<len;++i)if(a[i]>1e-6)ok|=i;
	for(int re i=1;i<len;i<<=1)
	for(int re j=0;j<len;j+=i<<1)
	for(int re k=0;k<i;++k)a[i|k|j]+=a[k|j];
	double ans=0;
	for(int re i=1;i<len;++i){
		double val=1/(1-a[(len-1)^i]);
	return 0;

Posted by joshberm on Tue, 08 Oct 2019 07:25:08 -0700