QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#504974#9112. Zayin and Raffleuntitledtwo#WA 393ms4144kbC++231.2kb2024-08-04 17:58:092024-08-04 17:58:09

Judging History

你现在查看的是最新测评结果

  • [2024-08-04 17:58:09]
  • 评测
  • 测评结果:WA
  • 用时:393ms
  • 内存:4144kb
  • [2024-08-04 17:58:09]
  • 提交

answer

#include<bits/stdc++.h>
#define up(i,x,y) for(int i=x,i##E=y;i<=i##E;i++)
#define pu(i,x,y) for(int i=y,i##E=x;i>=i##E;i--)
using namespace std;
#define int long long
int n,m,k;
const int mod=1e9+7;
int qpow(int a,int b=mod-2)
{
	int ans=1;
	while(b)
	{
		if(b&1)ans=ans*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return ans;
}
const int maxn=1e5+10;
int b[maxn];
int a[maxn];
const int maxm=(1<<16)+10;
int mul[maxm];
void Add(int &a,int b)
{
	a+=b;a%=mod;
}
signed main()
{
	int iv=qpow(1000000000);
	cin>>n>>m>>k;
	up(i,0,k-1)cin>>b[i],b[i]*=iv,b[i]%=mod;
	
	
	up(i,0,(1<<m)-1)mul[i]=1;
	
	up(i,1,n)
	{
		up(j,0,k-1)cin>>a[j];
		up(msk,1,(1<<k)-1)
		{
			int mk=-1;
			int val=0;
			up(j,0,k-1)
			{
				if(msk&(1<<j))
				{
					Add(val,b[j]);
					if(mk==-1)mk=a[j];
					mk&=a[j];
				}
			}
			mul[mk]*=val;
			mul[mk]%=mod;
			
		}
	}
	
	up(i,0,m-1)
	{
		up(j,0,(1<<m)-1)
		{
			if((j&(1<<i)))mul[j]*=mul[j^(1<<i)],mul[j]%=mod;
		}
	}
	
	up(i,0,m-1)
	{
		up(j,0,(1<<m)-1)
		{
			if(!(j&(1<<i)))mul[j]-=mul[j^(1<<i)],mul[j]+=mod,mul[j]%=mod;
		}
	}
	
	up(i,0,(1<<m)-1)
	{
		cout<<mul[i]<<"\n";
	}
	
	
	
	
	
	
	return 0;
}
/*
2 2 2
400000000 600000000
1 0
2 1
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 393ms
memory: 4144kb

input:

100000 16 8
14837 17850 15180 22820 26722 4874 4574 999893143
15006 45877 19815 26604 6797 0 25449 15769
26395 0 495 64118 18133 47822 5863 39708
56443 188 55498 14620 36924 25033 0 36587
55421 21544 59411 3280 55222 0 51028 55986
42323 41153 53683 16144 53188 15759 0 28378
63709 51900 0 18592 1916 ...

output:

312675224
918456391
500499768
905464731
673918916
765646478
302331443
130862422
592229307
704077619
790035877
466405037
710684456
553964298
46481407
340865135
180786643
718421649
638162163
15546501
765809160
759839353
343349246
218417314
548789394
774091075
83441022
465304870
248122141
298646005
221...

result:

wrong answer 1st lines differ - expected: '105532035', found: '312675224'