QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#575796#8150. XOR SumzxzxzxqAC ✓22ms8884kbC++141.7kb2024-09-19 16:49:432024-09-19 16:49:51

Judging History

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

  • [2024-09-19 16:49:51]
  • 评测
  • 测评结果:AC
  • 用时:22ms
  • 内存:8884kb
  • [2024-09-19 16:49:43]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define int long long

const int maxn = 110;
const int mod = 1e9 + 7;
int jc[maxn],upm[maxn],ans;
int f[maxn][350][20];
int C[maxn][maxn];

int powe(int a, int b) {
    int base = 1;
    while(b) {
        if(b & 1) base = base * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return base;
}

int cc(int n, int m) {
    // return C[n][m];
    return jc[n] * powe(jc[m], mod - 2) % mod * powe(jc[n - m], mod - 2) % mod;
}

int c(int n, int m) {
    return C[n][m];
    // return jc[n] * powe(jc[m], mod - 2) % mod * powe(jc[n - m], mod - 2) % mod;
}

signed main() {
    // freopen("data.in", "r", stdin);
    int n, m, k;
    cin >> n >> m >> k;
    f[61][0][k]=1;
    jc[0]=1;
    for(int i=1;i<=20;i++) jc[i]=jc[i-1]*i%mod;
    for(int i=0;i<=k;i++)
    for(int j=0;j<=i;j++)
    C[i][j]=cc(i,j);
    
    for(int i=60;i>=0;i--)
    {
        int now=1ll<<i;
        int lk=(n&now)!=0;
        for(int j=0;j<=k*k/2;j++)
        for(int w=0;w<=k;w++)
        for(int a=0;a<=k-w;a++)
        {
            if(now&m)
            {
                for(int b=0;b<=w;b++)
                {
                    int nowj=j*2+lk-(k-a-b)*(a+b);
                    if(nowj<0) continue;
                    f[i][nowj][b]=(f[i][nowj][b]+f[i+1][j][w]*c(k-w,a)%mod*c(w,b))%mod;
                }
            }
            else
            {
                int nowj=j*2+lk-(k-a)*a;
                if(nowj<0) continue;
                f[i][nowj][w]=(f[i][nowj][w]+f[i+1][j][w]*c(k-w,a))%mod;
                // if(i==60)cout<<f[i][nowj][w]<<'\n';
            }
        }
    }
    for(int i=0;i<=k;i++) ans+=f[0][0][i];
    cout<<ans%mod<<'\n';
    return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 5844kb

input:

6 2 3

output:

12

result:

ok 1 number(s): "12"

Test #2:

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

input:

30 6 5

output:

1520

result:

ok 1 number(s): "1520"

Test #3:

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

input:

0 0 1

output:

1

result:

ok 1 number(s): "1"

Test #4:

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

input:

0 0 2

output:

1

result:

ok 1 number(s): "1"

Test #5:

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

input:

0 1145141919 2

output:

145141913

result:

ok 1 number(s): "145141913"

Test #6:

score: 0
Accepted
time: 6ms
memory: 7924kb

input:

0 0 18

output:

1

result:

ok 1 number(s): "1"

Test #7:

score: 0
Accepted
time: 14ms
memory: 8296kb

input:

0 12412414 18

output:

12412415

result:

ok 1 number(s): "12412415"

Test #8:

score: 0
Accepted
time: 3ms
memory: 6612kb

input:

32071009996106 682053093123 12

output:

443207413

result:

ok 1 number(s): "443207413"

Test #9:

score: 0
Accepted
time: 2ms
memory: 6592kb

input:

35533005762427 688386210611 9

output:

0

result:

ok 1 number(s): "0"

Test #10:

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

input:

35533005762427 688386210611 18

output:

132815685

result:

ok 1 number(s): "132815685"

Test #11:

score: 0
Accepted
time: 22ms
memory: 8828kb

input:

12412412412412 549755813887 18

output:

769139144

result:

ok 1 number(s): "769139144"

Test #12:

score: 0
Accepted
time: 16ms
memory: 7348kb

input:

12412412412412 549755813887 17

output:

256540093

result:

ok 1 number(s): "256540093"

Test #13:

score: 0
Accepted
time: 12ms
memory: 6888kb

input:

12412412412412 549755813887 15

output:

661919152

result:

ok 1 number(s): "661919152"

Test #14:

score: 0
Accepted
time: 3ms
memory: 7124kb

input:

8213830533897 180838478436 12

output:

960275439

result:

ok 1 number(s): "960275439"

Test #15:

score: 0
Accepted
time: 13ms
memory: 7224kb

input:

8213830533897 180838478436 18

output:

794870059

result:

ok 1 number(s): "794870059"

Test #16:

score: 0
Accepted
time: 3ms
memory: 6492kb

input:

56737445336495 759179417237 12

output:

0

result:

ok 1 number(s): "0"

Test #17:

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

input:

56737445336495 759179417237 18

output:

302105482

result:

ok 1 number(s): "302105482"

Test #18:

score: 0
Accepted
time: 4ms
memory: 7944kb

input:

56737445336495 759179417237 15

output:

0

result:

ok 1 number(s): "0"

Test #19:

score: 0
Accepted
time: 7ms
memory: 7724kb

input:

12412412412412 274877906944 18

output:

430003400

result:

ok 1 number(s): "430003400"

Test #20:

score: 0
Accepted
time: 7ms
memory: 8884kb

input:

32412412412412 274877906944 18

output:

657686236

result:

ok 1 number(s): "657686236"

Test #21:

score: 0
Accepted
time: 22ms
memory: 7432kb

input:

562949953421311 549755813887 18

output:

0

result:

ok 1 number(s): "0"

Test #22:

score: 0
Accepted
time: 17ms
memory: 7740kb

input:

985162418487295 549755813887 18

output:

0

result:

ok 1 number(s): "0"

Test #23:

score: 0
Accepted
time: 22ms
memory: 7620kb

input:

985162418487295 962072674303 18

output:

0

result:

ok 1 number(s): "0"

Test #24:

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

input:

35184372088831 962072674303 18

output:

665848241

result:

ok 1 number(s): "665848241"

Extra Test:

score: 0
Extra Test Passed