# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
211271 | bash | Asceticism (JOI18_asceticism) | C++17 | 48 ms | 24952 KiB |
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;
const int mod = 1e9 + 7;
int n,m;
int dp[3005][3005];
int add(int x, int y) {
return ((x+y)%mod + mod)%mod;
}
int mul(int x, int y) {
return ((1LL*x*y)%mod + mod)%mod;
}
int main() {
scanf("%d%d",&n,&m);
dp[1][1] = 1;
for(int x=2;x<=n;x++) {
for(int k=1;k<=m;k++) {
dp[x][k] = add(mul(x-k+1, dp[x-1][k-1]), mul(k, dp[x-1][k]));
}
}
printf("%d",dp[n][m]);
}
Compilation message (stderr)
# | 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... |