# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
364206 | fhvirus | Asceticism (JOI18_asceticism) | C++17 | 8 ms | 8300 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<cstdio>
#include<cassert>
#define ll long long
const int N = 3003, M = 1'000'000'007;
ll dp[N][N];
int main(){
int n, k; scanf("%d%d", &n, &k);
assert(n <= 3000);
dp[0][0] = 1;
for(int i = 1; i <= n; ++i){
for(int j = 1; j <= i and j <= k; ++j){
dp[i][j] += dp[i-1][j] * j;
dp[i][j] += dp[i-1][j-1] * (i - (j - 1));
dp[i][j] %= M;
}
}
// for(int i = 0; i <= n; ++i){
// for(int j = 0; j < k; ++j){
// printf("%lld ", dp[i][j]);
// }
// puts("");
// }
printf("%lld", dp[n][k]);
return 0;
}
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... |