QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#706827 | #8150. XOR Sum | Yaimsea# | AC ✓ | 20ms | 4856kb | C++14 | 1.8kb | 2024-11-03 13:35:42 | 2024-11-03 13:35:44 |
Judging History
answer
#include <bits/stdc++.h>
#define ll long long
#define db double
#define down 0.9972
#define MAXN 100000
#define mid ((l + r) >> 1)
using namespace std;
ll read() {
ll x = 0, f = 1; char ch = getchar();
while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
while(ch >= '0' && ch <= '9') {x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar();}
return x * f;
}
const int mod = 1e9 + 7;
ll f[100][1010][20];
ll n, m, k, c[110][110];
void solve() {
n = read(); m = read(); k = read();
c[0][0] = 1;
for(int i = 1; i <= k; i++)
for(int j = 0; j <= i; j++) {
c[i][j] = 1;
for(int p = 1; p <= j; p++)
c[i][j] = c[i][j] * (i - p + 1) / p;
}
f[0][0][0] = 1;
for(int i = 1; i <= 60; i++) {
int bt = (m >> (i - 1)) & 1, pt = (n >> (i - 1) & 1);
for(int j = 0; j <= 1000; j++) {//有p个大于m
for(int q = 0; q <= k; q++) {//选q个1
ll vl = j + q * (k - q);
if((vl & 1) != pt) continue;
for(int p = 0; p <= k; p++) {
if(!f[i - 1][j][p]) continue;
if(bt) {
for(int x = max(0ll, q - k + p); x <= min(p, q); x++) {
f[i][vl / 2][x] += f[i - 1][j][p] * c[p][x] * c[k - p][q - x], f[i][vl / 2][x] %= mod;
//printf("%d %d %d %lld -> %d %lld %d %lld\n", i - 1, j, p, f[i - 1][j][p], i, vl / 2, x, f[i][vl / 2][x]);
}
}
else {
for(int x = max(0ll, q - k + p); x <= min(p, q); x++) {
f[i][vl / 2][p + (q - x)] += f[i - 1][j][p] * c[p][x] * c[k - p][q - x] % mod, f[i][vl / 2][p + (q - x)] %= mod;
//printf("%d %d %d %lld -> %d %lld %d %lld\n", i - 1, j, p, f[i - 1][j][p], i, vl / 2, p + (q - x), f[i][vl / 2][p + (q - x)]);
}
}
}
}
}
}
printf("%lld\n", f[60][0][0]);
}
int main() {
solve();
return 0;
}
/*
5
14 5
7 13 1 6 14 2 16 17 18 19 34 36 20 23
*/
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3976kb
input:
6 2 3
output:
12
result:
ok 1 number(s): "12"
Test #2:
score: 0
Accepted
time: 2ms
memory: 4176kb
input:
30 6 5
output:
1520
result:
ok 1 number(s): "1520"
Test #3:
score: 0
Accepted
time: 0ms
memory: 4128kb
input:
0 0 1
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 1ms
memory: 3992kb
input:
0 0 2
output:
1
result:
ok 1 number(s): "1"
Test #5:
score: 0
Accepted
time: 1ms
memory: 4000kb
input:
0 1145141919 2
output:
145141913
result:
ok 1 number(s): "145141913"
Test #6:
score: 0
Accepted
time: 20ms
memory: 4812kb
input:
0 0 18
output:
1
result:
ok 1 number(s): "1"
Test #7:
score: 0
Accepted
time: 19ms
memory: 4748kb
input:
0 12412414 18
output:
12412415
result:
ok 1 number(s): "12412415"
Test #8:
score: 0
Accepted
time: 7ms
memory: 4320kb
input:
32071009996106 682053093123 12
output:
443207413
result:
ok 1 number(s): "443207413"
Test #9:
score: 0
Accepted
time: 4ms
memory: 3812kb
input:
35533005762427 688386210611 9
output:
0
result:
ok 1 number(s): "0"
Test #10:
score: 0
Accepted
time: 16ms
memory: 4800kb
input:
35533005762427 688386210611 18
output:
132815685
result:
ok 1 number(s): "132815685"
Test #11:
score: 0
Accepted
time: 15ms
memory: 4796kb
input:
12412412412412 549755813887 18
output:
769139144
result:
ok 1 number(s): "769139144"
Test #12:
score: 0
Accepted
time: 9ms
memory: 4792kb
input:
12412412412412 549755813887 17
output:
256540093
result:
ok 1 number(s): "256540093"
Test #13:
score: 0
Accepted
time: 5ms
memory: 4568kb
input:
12412412412412 549755813887 15
output:
661919152
result:
ok 1 number(s): "661919152"
Test #14:
score: 0
Accepted
time: 7ms
memory: 4328kb
input:
8213830533897 180838478436 12
output:
960275439
result:
ok 1 number(s): "960275439"
Test #15:
score: 0
Accepted
time: 16ms
memory: 4712kb
input:
8213830533897 180838478436 18
output:
794870059
result:
ok 1 number(s): "794870059"
Test #16:
score: 0
Accepted
time: 7ms
memory: 4380kb
input:
56737445336495 759179417237 12
output:
0
result:
ok 1 number(s): "0"
Test #17:
score: 0
Accepted
time: 19ms
memory: 4784kb
input:
56737445336495 759179417237 18
output:
302105482
result:
ok 1 number(s): "302105482"
Test #18:
score: 0
Accepted
time: 8ms
memory: 3828kb
input:
56737445336495 759179417237 15
output:
0
result:
ok 1 number(s): "0"
Test #19:
score: 0
Accepted
time: 20ms
memory: 4784kb
input:
12412412412412 274877906944 18
output:
430003400
result:
ok 1 number(s): "430003400"
Test #20:
score: 0
Accepted
time: 20ms
memory: 4724kb
input:
32412412412412 274877906944 18
output:
657686236
result:
ok 1 number(s): "657686236"
Test #21:
score: 0
Accepted
time: 11ms
memory: 4760kb
input:
562949953421311 549755813887 18
output:
0
result:
ok 1 number(s): "0"
Test #22:
score: 0
Accepted
time: 12ms
memory: 4708kb
input:
985162418487295 549755813887 18
output:
0
result:
ok 1 number(s): "0"
Test #23:
score: 0
Accepted
time: 15ms
memory: 4792kb
input:
985162418487295 962072674303 18
output:
0
result:
ok 1 number(s): "0"
Test #24:
score: 0
Accepted
time: 15ms
memory: 4856kb
input:
35184372088831 962072674303 18
output:
665848241
result:
ok 1 number(s): "665848241"
Extra Test:
score: 0
Extra Test Passed