This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<stdio.h>
int n,m;
long long int dp[1010][1010];
int mod=1000000007;
int main(){
int i,j;
scanf("%d%d",&n,&m);
for(i=1;i<=m;i++){
dp[1][i]=1;
}
for(j=2;j<=n;j++){
for(i=1;i<=m;i++){
dp[j][i]=dp[j-1][i]*i+dp[j-1][i-1]*(j-i);
dp[j][i]%=mod;
}
}
printf("%lld",dp[n][m]);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |