QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#625377#8150. XOR SumLayn#AC ✓361ms11368kbC++141.6kb2024-10-09 18:55:552024-10-09 18:55:56

Judging History

你现在查看的是最新测评结果

  • [2024-10-09 18:55:56]
  • 评测
  • 测评结果:AC
  • 用时:361ms
  • 内存:11368kb
  • [2024-10-09 18:55:55]
  • 提交

answer

//
// Created by Layn on 24-10-9.
//
#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
    using namespace std;
    const int mod = 1000000007;
    long long n = 0, m = 0, k = 0;
    map<pair<int, pair<long long, int> >, int> vis;
    map<pair<int, pair<long long, int> >, int> f;
    int C[205][205];
int dfs(int x, long long w, int y) {
    if (w < 0) return 0;
    if (w - k / 2 * (k - k / 2) * ((1ll << (x + 1)) - 1) > 0)
        return 0;
    if (x < 0) return 1;
    pair<int, pair<long long, int> > st = make_pair(x, make_pair(w, y));
    if (vis[st]) return f[st];
    vis[st] = true;
    int res = 0;
    long long val = (1ll << x);
    for (int i = 0; i <= k; i++) {
        // i: 0 , k - i: 1
        long long d = i * (k - i) * val;
        if (w - d < 0) continue;
        if ((m >> x) & 1) {
            for (int j = 0; j <= min((long long)y, k - i); j++)
                res = (res + (long long)dfs(x - 1, w - d, j) * C[y][j] % mod * C[k - y][k - i - j] % mod) % mod;
        } else {
            if (k - i > k - y) continue;
            res = (res + (long long)dfs(x - 1, w - d, y) * C[k - y][k - i]) % mod;
        }
    }
        //return vis[make_pair(x, w)] = true;
    f[st] = res;
    return res;
}
int main() {
    scanf("%lld%lld%lld", &n, &m, &k);
    for (int i = 0; i <= k; i++) C[i][0] = 1;
    for (int i = 1; i <= k; i++)
        for (int j = 1; j <= i; j++)
            C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % mod;
    int t = 0;
    for (t = 0; (1ll << t) <= m; t++);
    t--;
    printf("%d\n", dfs(t, n, k));
    return 0;
}
// 10000000000000 1000000000000 18

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3900kb

input:

6 2 3

output:

12

result:

ok 1 number(s): "12"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3820kb

input:

30 6 5

output:

1520

result:

ok 1 number(s): "1520"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3768kb

input:

0 0 1

output:

1

result:

ok 1 number(s): "1"

Test #4:

score: 0
Accepted
time: 0ms
memory: 3904kb

input:

0 0 2

output:

1

result:

ok 1 number(s): "1"

Test #5:

score: 0
Accepted
time: 0ms
memory: 3924kb

input:

0 1145141919 2

output:

145141913

result:

ok 1 number(s): "145141913"

Test #6:

score: 0
Accepted
time: 0ms
memory: 3904kb

input:

0 0 18

output:

1

result:

ok 1 number(s): "1"

Test #7:

score: 0
Accepted
time: 1ms
memory: 3888kb

input:

0 12412414 18

output:

12412415

result:

ok 1 number(s): "12412415"

Test #8:

score: 0
Accepted
time: 20ms
memory: 5740kb

input:

32071009996106 682053093123 12

output:

443207413

result:

ok 1 number(s): "443207413"

Test #9:

score: 0
Accepted
time: 0ms
memory: 3960kb

input:

35533005762427 688386210611 9

output:

0

result:

ok 1 number(s): "0"

Test #10:

score: 0
Accepted
time: 183ms
memory: 11120kb

input:

35533005762427 688386210611 18

output:

132815685

result:

ok 1 number(s): "132815685"

Test #11:

score: 0
Accepted
time: 361ms
memory: 11268kb

input:

12412412412412 549755813887 18

output:

769139144

result:

ok 1 number(s): "769139144"

Test #12:

score: 0
Accepted
time: 120ms
memory: 6992kb

input:

12412412412412 549755813887 17

output:

256540093

result:

ok 1 number(s): "256540093"

Test #13:

score: 0
Accepted
time: 65ms
memory: 6080kb

input:

12412412412412 549755813887 15

output:

661919152

result:

ok 1 number(s): "661919152"

Test #14:

score: 0
Accepted
time: 15ms
memory: 5648kb

input:

8213830533897 180838478436 12

output:

960275439

result:

ok 1 number(s): "960275439"

Test #15:

score: 0
Accepted
time: 165ms
memory: 10996kb

input:

8213830533897 180838478436 18

output:

794870059

result:

ok 1 number(s): "794870059"

Test #16:

score: 0
Accepted
time: 1ms
memory: 3784kb

input:

56737445336495 759179417237 12

output:

0

result:

ok 1 number(s): "0"

Test #17:

score: 0
Accepted
time: 161ms
memory: 10656kb

input:

56737445336495 759179417237 18

output:

302105482

result:

ok 1 number(s): "302105482"

Test #18:

score: 0
Accepted
time: 21ms
memory: 5492kb

input:

56737445336495 759179417237 15

output:

0

result:

ok 1 number(s): "0"

Test #19:

score: 0
Accepted
time: 47ms
memory: 11368kb

input:

12412412412412 274877906944 18

output:

430003400

result:

ok 1 number(s): "430003400"

Test #20:

score: 0
Accepted
time: 43ms
memory: 10092kb

input:

32412412412412 274877906944 18

output:

657686236

result:

ok 1 number(s): "657686236"

Test #21:

score: 0
Accepted
time: 0ms
memory: 3784kb

input:

562949953421311 549755813887 18

output:

0

result:

ok 1 number(s): "0"

Test #22:

score: 0
Accepted
time: 0ms
memory: 3912kb

input:

985162418487295 549755813887 18

output:

0

result:

ok 1 number(s): "0"

Test #23:

score: 0
Accepted
time: 0ms
memory: 3964kb

input:

985162418487295 962072674303 18

output:

0

result:

ok 1 number(s): "0"

Test #24:

score: 0
Accepted
time: 334ms
memory: 11136kb

input:

35184372088831 962072674303 18

output:

665848241

result:

ok 1 number(s): "665848241"

Extra Test:

score: 0
Extra Test Passed