QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#410981 | #8150. XOR Sum | sycqwq | AC ✓ | 120ms | 11568kb | C++14 | 1.2kb | 2024-05-14 19:22:45 | 2024-05-14 19:22:47 |
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>1024)
continue;
// cerr<<i<<' '<<j<<' '<<k<<'\n';
if((1ll<<i-1&m)==0)
{
if(K-k<t)
continue;
(f[i-1][tarj][k]+=C[K-k][t]*f[i][j][k]%mod)%=mod;
// cerr<<i<<' '<<K-k<<' '<<C[K-k][t]*f[i][j][k]<<' '<<f[i-1][tarj][k]<<"QWQ\n";
// 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<=K;i++)
(s+=f[0][0][i])%=mod;
cout<<s;
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3944kb
input:
6 2 3
output:
12
result:
ok 1 number(s): "12"
Test #2:
score: 0
Accepted
time: 1ms
memory: 3936kb
input:
30 6 5
output:
1520
result:
ok 1 number(s): "1520"
Test #3:
score: 0
Accepted
time: 1ms
memory: 5836kb
input:
0 0 1
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 1ms
memory: 3880kb
input:
0 0 2
output:
1
result:
ok 1 number(s): "1"
Test #5:
score: 0
Accepted
time: 1ms
memory: 3732kb
input:
0 1145141919 2
output:
145141913
result:
ok 1 number(s): "145141913"
Test #6:
score: 0
Accepted
time: 2ms
memory: 5868kb
input:
0 0 18
output:
1
result:
ok 1 number(s): "1"
Test #7:
score: 0
Accepted
time: 1ms
memory: 3736kb
input:
0 12412414 18
output:
12412415
result:
ok 1 number(s): "12412415"
Test #8:
score: 0
Accepted
time: 23ms
memory: 11568kb
input:
32071009996106 682053093123 12
output:
443207413
result:
ok 1 number(s): "443207413"
Test #9:
score: 0
Accepted
time: 1ms
memory: 3900kb
input:
35533005762427 688386210611 9
output:
0
result:
ok 1 number(s): "0"
Test #10:
score: 0
Accepted
time: 64ms
memory: 9556kb
input:
35533005762427 688386210611 18
output:
132815685
result:
ok 1 number(s): "132815685"
Test #11:
score: 0
Accepted
time: 120ms
memory: 9340kb
input:
12412412412412 549755813887 18
output:
769139144
result:
ok 1 number(s): "769139144"
Test #12:
score: 0
Accepted
time: 50ms
memory: 11456kb
input:
12412412412412 549755813887 17
output:
256540093
result:
ok 1 number(s): "256540093"
Test #13:
score: 0
Accepted
time: 37ms
memory: 11512kb
input:
12412412412412 549755813887 15
output:
661919152
result:
ok 1 number(s): "661919152"
Test #14:
score: 0
Accepted
time: 19ms
memory: 9336kb
input:
8213830533897 180838478436 12
output:
960275439
result:
ok 1 number(s): "960275439"
Test #15:
score: 0
Accepted
time: 51ms
memory: 11344kb
input:
8213830533897 180838478436 18
output:
794870059
result:
ok 1 number(s): "794870059"
Test #16:
score: 0
Accepted
time: 2ms
memory: 3868kb
input:
56737445336495 759179417237 12
output:
0
result:
ok 1 number(s): "0"
Test #17:
score: 0
Accepted
time: 57ms
memory: 9688kb
input:
56737445336495 759179417237 18
output:
302105482
result:
ok 1 number(s): "302105482"
Test #18:
score: 0
Accepted
time: 15ms
memory: 9848kb
input:
56737445336495 759179417237 15
output:
0
result:
ok 1 number(s): "0"
Test #19:
score: 0
Accepted
time: 3ms
memory: 9528kb
input:
12412412412412 274877906944 18
output:
430003400
result:
ok 1 number(s): "430003400"
Test #20:
score: 0
Accepted
time: 16ms
memory: 9516kb
input:
32412412412412 274877906944 18
output:
657686236
result:
ok 1 number(s): "657686236"
Test #21:
score: 0
Accepted
time: 1ms
memory: 3692kb
input:
562949953421311 549755813887 18
output:
0
result:
ok 1 number(s): "0"
Test #22:
score: 0
Accepted
time: 1ms
memory: 3688kb
input:
985162418487295 549755813887 18
output:
0
result:
ok 1 number(s): "0"
Test #23:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
985162418487295 962072674303 18
output:
0
result:
ok 1 number(s): "0"
Test #24:
score: 0
Accepted
time: 110ms
memory: 9740kb
input:
35184372088831 962072674303 18
output:
665848241
result:
ok 1 number(s): "665848241"
Extra Test:
score: 0
Extra Test Passed