QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#410294 | #8150. XOR Sum | sycqwq# | WA | 2ms | 5780kb | C++14 | 1.3kb | 2024-05-13 20:53:26 | 2024-05-13 20:53:27 |
Judging History
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[60][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=60;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;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3856kb
input:
6 2 3
output:
12
result:
ok 1 number(s): "12"
Test #2:
score: 0
Accepted
time: 2ms
memory: 5752kb
input:
30 6 5
output:
1520
result:
ok 1 number(s): "1520"
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 5780kb
input:
0 0 1
output:
0
result:
wrong answer 1st numbers differ - expected: '1', found: '0'