QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#476483#2568. MountainsweiguoliangWA 0ms3732kbC++141.6kb2024-07-13 19:49:012024-07-13 19:49:01

Judging History

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

  • [2024-07-13 19:49:01]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3732kb
  • [2024-07-13 19:49:01]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
#define N 105
#define mod 1000000007
using namespace std;
ll n,m,k,a[N][N],jie[N<<2],inv[N<<2];
ll qpow(ll a,ll b){ll ans=1;
    while(b){
        if(b&1)ans=ans*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return ans;
}
ll sh(ll n){ll i,k,j,l,ans=1;
    for(i=1;i<=n;i++){
        for(k=i+1;k<=n;k++)if(a[k][i])swap(a[k],a[i]),ans=-ans;
        if(!a[i][i]){cout<<0;
            return 0;
        }
        for(k=i+1;k<=n;k++){
            while(a[k][i]){
                if(!a[i][i]){
                    if(a[k][i]){
                        swap(a[i],a[k]),ans=-ans;
                        break;
                    }
                    else{
                        cout<<0;
                        return 0;
                    }
                }
                l=a[k][i]/a[i][i];
                for(j=1;j<=n;j++)a[k][j]=(a[k][j]-a[i][j]*l%mod+mod)%mod;
                swap(a[k],a[i]),ans=-ans;
            }
        }
    }
    if(ans==-1)ans=(ans+mod)%mod;
    for(i=1;i<=n;i++)ans=ans*a[i][i]%mod;
    return ans;
}
ll c(ll n,ll m){
    if(n>m||n<0)return 0;
    return jie[m]*inv[m-n]%mod*inv[n]%mod;
}
int main(){ll i,j;
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    cin>>n>>m>>k;
    jie[0]=1;
    for(i=1;i<=(n<<2);i++)jie[i]=jie[i-1]*i%mod;
    inv[n<<2]=qpow(jie[n<<2],mod-2);
    for(i=(n<<2)-1;i>=0;i--)inv[i]=inv[i+1]*(i+1)%mod;
    for(i=1;i<=k;i++){
        for(j=1;j<=k;j++){
            a[i][j]=c(m+i-j,m+n);
        }
    }
    cout<<sh(k);
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1 1 1

output:

2

result:

ok 1 number(s): "2"

Test #2:

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

input:

2 2 2

output:

20

result:

ok 1 number(s): "20"

Test #3:

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

input:

2 3 4

output:

490

result:

ok 1 number(s): "490"

Test #4:

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

input:

1 2 8

output:

45

result:

ok 1 number(s): "45"

Test #5:

score: -100
Wrong Answer
time: 0ms
memory: 3672kb

input:

1 10 2

output:

00

result:

wrong output format Expected integer, but "00" found