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<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e,i,j,ii,jj,zx,xc,dp[3004][3004],mod=1000000007LL;
int main(){
ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
cin>>a>>b;
dp[1][0]=1;
for(i=1; i<a; i++){
for(j=0; j<=min(b,i-1); j++){
dp[i+1][j]+=dp[i][j]*(j+1);
dp[i+1][j+1]+=dp[i][j]*(i-j);
}
}
cout<<dp[a][b-1];
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |