QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#410292#8150. XOR Sumsycqwq#WA 1ms5872kbC++141.3kb2024-05-13 20:53:002024-05-13 20:53:01

Judging History

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

  • [2024-05-13 20:53:01]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5872kb
  • [2024-05-13 20:53:00]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int mod=1e9+7,maxn=25;
int f[65][1035][20],n,m,K,C[maxn][maxn];

signed main()
{
	cin>>n>>m>>K;
	f[50][0][K]=1;
	C[0][0]=1;
	for(int i=1;i<=K;i++)
	{
		C[i][0]=1;
		for(int j=1;j<=K;j++)
			C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
	}
//	cerr<<"OK\n";
	for(int i=50;i>0;i--)
	{
		for(int j=0;j<=1024;j++)
		{
			for(int k=0;k<=K;k++)
			{
				if(f[i][j][k]==0)
					continue;
				for(int t=0;t<=K;t++)
				{
					int tarj=n>>i-1&1;
					tarj+=j<<1;
					int now=t*(K-t);
					tarj-=now;
					if(tarj<0||tarj>6)
						continue;
//					cerr<<i<<' '<<j<<' '<<k<<' '<<f[i][j][k]<<' '<<t<<' '<<tarj<<' '<<now<<'\n';
//					cerr<<i<<' '<<j<<' '<<k<<'\n';
					if((1ll<<i-1&m)==0)
					{
						if(K-k<t)
							continue;
//						cerr<<K-k<<' '<<"QWQ\n";
						(f[i-1][tarj][k]+=C[K-k][t]*f[i][j][k]%mod)%=mod;
//						cerr<<"OK\n";
						continue;
					}
					for(int l=0;l<=k;l++)
					{
						if(l+K-k<t||l>t)
							continue;
						(f[i-1][tarj][l]+=C[k][l]*C[K-k][t-l]%mod*f[i][j][k]%mod)%=mod;
//						cerr<<l<<' '<<f[i-1][tarj][l]<<' '<<C[k][l]<<' '<<C[K-k][t-l]<<'\n';
					}
				}
			}
		}
	}
	int s=0;
	for(int i=0;i<=n;i++)
		(s+=f[0][0][i])%=mod;
	cout<<s;
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 5760kb

input:

6 2 3

output:

12

result:

ok 1 number(s): "12"

Test #2:

score: 0
Accepted
time: 1ms
memory: 5872kb

input:

30 6 5

output:

1520

result:

ok 1 number(s): "1520"

Test #3:

score: -100
Wrong Answer
time: 1ms
memory: 5748kb

input:

0 0 1

output:

0

result:

wrong answer 1st numbers differ - expected: '1', found: '0'