QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#372513 | #8150. XOR Sum | sgweo8ys | WA | 3ms | 4192kb | C++14 | 2.1kb | 2024-03-31 14:26:59 | 2024-03-31 14:27:00 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
using namespace std;
typedef long long ull;
const int N = 55;
const int M = 110;
const int K = 25;
const int p = 1000000007;
ull n, m, k, f[N][M][K], C[N][N];
void prework()
{
for(int i = 0; i <= k; i++) C[i][0] = C[i][i] = 1;
for(int i = 1; i <= k; i++)
for(int j = 1; j <= k; j++) C[i][j] = C[i - 1][j] + C[i - 1][j - 1];
}
ull c(int n, int m)
{
if(n < m || m < 0) return 0;
return C[n][m];
}
signed main()
{
cin >> n >> m >> k;
prework();
ull bt = 1, bi = 0;
while(bt * 2 <= m) bt <<= 1, bi++;
f[bi + 1][n / (bt * 2)][k] = 1;
//cout << bi << " " << k << " " << endl;
for(int bn = bi; bn >= 0; bn--){ //40
for(int i = 0; i <= k; i++){ // 18
int tms = i * (k - i);
for(int j = tms / 2; j <= 81; j++){ // 81
int rst = 2 * j + (bool)(n & (1ull << bn));
if(rst * 2 - tms * 2 > 81) break;
if(rst - tms < 0) continue;
for(int u = 0; u <= k; u++){//18
if((m & (1ull << bn)) == 0){
if(i <= k - u){
f[bn][rst - tms][u] += f[bn + 1][j][u] * c(k - u, i);
f[bn][rst - tms][u] %= p;
}
}
else{
for(int u1 = u; u1 >= 0; u1--){//18
if(i < u - u1) break;
f[bn][rst - tms][u1] += f[bn + 1][j][u] * (c(u, u - u1) * c(k - u, i - (u - u1)) % p);
f[bn][rst - tms][u1] %= p;
}
}
}
}
}
/*
for(int i = 0; i <= 4; i++){
for(int u = 0; u <= k; u++) cout << f[bn][i][u] << " ";
cout <<endl;
}
cout << endl;
*/
}
ull ans = 0;
for(int i = 0; i <= k; i++) ans += f[0][0][i], ans %= p;
cout << ans % p << endl;
return 0;
}
// 6 2 3
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3568kb
input:
6 2 3
output:
12
result:
ok 1 number(s): "12"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
30 6 5
output:
1520
result:
ok 1 number(s): "1520"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
0 0 1
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3504kb
input:
0 0 2
output:
1
result:
ok 1 number(s): "1"
Test #5:
score: 0
Accepted
time: 1ms
memory: 3860kb
input:
0 1145141919 2
output:
145141913
result:
ok 1 number(s): "145141913"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
0 0 18
output:
1
result:
ok 1 number(s): "1"
Test #7:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
0 12412414 18
output:
12412415
result:
ok 1 number(s): "12412415"
Test #8:
score: 0
Accepted
time: 2ms
memory: 4192kb
input:
32071009996106 682053093123 12
output:
443207413
result:
ok 1 number(s): "443207413"
Test #9:
score: 0
Accepted
time: 1ms
memory: 4088kb
input:
35533005762427 688386210611 9
output:
0
result:
ok 1 number(s): "0"
Test #10:
score: -100
Wrong Answer
time: 3ms
memory: 4100kb
input:
35533005762427 688386210611 18
output:
590751837
result:
wrong answer 1st numbers differ - expected: '132815685', found: '590751837'