# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
171894 | arnold518 | Asceticism (JOI18_asceticism) | C++14 | 128 ms | 94712 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;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MAXN = 3000;
const ll MOD = 1e9+7;
int N, K;
ll dp[MAXN+10][MAXN+10];
int main()
{
int i, j;
scanf("%d%d", &N, &K);
dp[1][1]=1;
for(i=2; i<=N; i++) for(j=1; j<=i; j++) dp[i][j]=(j*dp[i-1][j]+(i-j+1)*dp[i-1][j-1])%MOD;
printf("%lld", dp[N][K]);
}
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... |