QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#476488#2568. MountainsweiguoliangWA 0ms3708kbC++141.4kb2024-07-13 19:49:462024-07-13 19:49:47

Judging History

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

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

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])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 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);
}

详细

Test #1:

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

input:

1 1 1

output:

2

result:

ok 1 number(s): "2"

Test #2:

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

input:

2 2 2

output:

20

result:

ok 1 number(s): "20"

Test #3:

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

input:

2 3 4

output:

490

result:

ok 1 number(s): "490"

Test #4:

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

input:

1 2 8

output:

45

result:

ok 1 number(s): "45"

Test #5:

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

input:

1 10 2

output:

0

result:

wrong answer 1st numbers differ - expected: '66', found: '0'