QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#410263 | #8150. XOR Sum | Graphcity# | AC ✓ | 10ms | 8444kb | C++14 | 959b | 2024-05-13 20:20:50 | 2024-05-13 20:20:51 |
Judging History
answer
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rof(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
using namespace std;
const int Maxn=1e3,Mod=1e9+7;
ll n,m; int K,C[55][55];
int f[64][20][Maxn+5];
int main()
{
// freopen("1.in","r",stdin);
cin>>n>>m>>K; C[0][0]=1;
For(i,1,50)
{
C[i][0]=1;
For(j,1,i) {C[i][j]=(C[i-1][j]+C[i-1][j-1])%Mod;}
}
For(i,0,K) f[0][i][0]=C[K][i];
For(i,0,62)
{
int p=(m>>i)&1,op=(n>>i)&1;
For(j,0,K) For(k,0,Maxn) if(f[i][j][k]) For(k1,0,K-j)
{
int cnt,res=1ll*f[i][j][k]*C[K-j][k1]%Mod;
if(!p) cnt=(k1+j)*(K-k1-j); else cnt=k1*(K-k1);
if((cnt+k)%2!=op) continue;
if(!p) (f[i+1][j][(cnt+k)/2]+=res)%=Mod;
else
{
For(l,0,k1)
{
int now=1ll*res*C[k1][l]%Mod;
(f[i+1][j+l][(cnt+k)/2]+=now)%=Mod;
}
}
}
}
cout<<f[63][K][0]<<endl;
return 0;
}
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 4508kb
input:
6 2 3
output:
12
result:
ok 1 number(s): "12"
Test #2:
score: 0
Accepted
time: 1ms
memory: 5136kb
input:
30 6 5
output:
1520
result:
ok 1 number(s): "1520"
Test #3:
score: 0
Accepted
time: 1ms
memory: 4120kb
input:
0 0 1
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 0ms
memory: 4456kb
input:
0 0 2
output:
1
result:
ok 1 number(s): "1"
Test #5:
score: 0
Accepted
time: 0ms
memory: 4244kb
input:
0 1145141919 2
output:
145141913
result:
ok 1 number(s): "145141913"
Test #6:
score: 0
Accepted
time: 3ms
memory: 8388kb
input:
0 0 18
output:
1
result:
ok 1 number(s): "1"
Test #7:
score: 0
Accepted
time: 8ms
memory: 8416kb
input:
0 12412414 18
output:
12412415
result:
ok 1 number(s): "12412415"
Test #8:
score: 0
Accepted
time: 3ms
memory: 6892kb
input:
32071009996106 682053093123 12
output:
443207413
result:
ok 1 number(s): "443207413"
Test #9:
score: 0
Accepted
time: 1ms
memory: 3584kb
input:
35533005762427 688386210611 9
output:
0
result:
ok 1 number(s): "0"
Test #10:
score: 0
Accepted
time: 8ms
memory: 8332kb
input:
35533005762427 688386210611 18
output:
132815685
result:
ok 1 number(s): "132815685"
Test #11:
score: 0
Accepted
time: 9ms
memory: 8300kb
input:
12412412412412 549755813887 18
output:
769139144
result:
ok 1 number(s): "769139144"
Test #12:
score: 0
Accepted
time: 8ms
memory: 8212kb
input:
12412412412412 549755813887 17
output:
256540093
result:
ok 1 number(s): "256540093"
Test #13:
score: 0
Accepted
time: 0ms
memory: 7720kb
input:
12412412412412 549755813887 15
output:
661919152
result:
ok 1 number(s): "661919152"
Test #14:
score: 0
Accepted
time: 0ms
memory: 6936kb
input:
8213830533897 180838478436 12
output:
960275439
result:
ok 1 number(s): "960275439"
Test #15:
score: 0
Accepted
time: 4ms
memory: 8444kb
input:
8213830533897 180838478436 18
output:
794870059
result:
ok 1 number(s): "794870059"
Test #16:
score: 0
Accepted
time: 0ms
memory: 6892kb
input:
56737445336495 759179417237 12
output:
0
result:
ok 1 number(s): "0"
Test #17:
score: 0
Accepted
time: 5ms
memory: 8332kb
input:
56737445336495 759179417237 18
output:
302105482
result:
ok 1 number(s): "302105482"
Test #18:
score: 0
Accepted
time: 1ms
memory: 3736kb
input:
56737445336495 759179417237 15
output:
0
result:
ok 1 number(s): "0"
Test #19:
score: 0
Accepted
time: 3ms
memory: 8336kb
input:
12412412412412 274877906944 18
output:
430003400
result:
ok 1 number(s): "430003400"
Test #20:
score: 0
Accepted
time: 0ms
memory: 8188kb
input:
32412412412412 274877906944 18
output:
657686236
result:
ok 1 number(s): "657686236"
Test #21:
score: 0
Accepted
time: 10ms
memory: 8356kb
input:
562949953421311 549755813887 18
output:
0
result:
ok 1 number(s): "0"
Test #22:
score: 0
Accepted
time: 10ms
memory: 8268kb
input:
985162418487295 549755813887 18
output:
0
result:
ok 1 number(s): "0"
Test #23:
score: 0
Accepted
time: 6ms
memory: 8348kb
input:
985162418487295 962072674303 18
output:
0
result:
ok 1 number(s): "0"
Test #24:
score: 0
Accepted
time: 3ms
memory: 8424kb
input:
35184372088831 962072674303 18
output:
665848241
result:
ok 1 number(s): "665848241"
Extra Test:
score: 0
Extra Test Passed