# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
469268 | keta_tsimakuridze | Asceticism (JOI18_asceticism) | C++14 | 47 ms | 24988 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>
#define f first
#define s second
#define int long long
#define pii pair<int,int>
using namespace std;
const int N = 3e3 + 5, mod = 1e9 + 7; // !
int t,n,dp[N][N],k;
main(){
cin >> n >> k;
dp[0][0] = 1;
for(int i = 1; i <= n; i++) {
for(int j = 0; j < k; j++) {
dp[i][j] = dp[i - 1][j] * (j + 1);
if(j) dp[i][j] = (dp[i][j] + dp[i - 1][j - 1] * (i - 1 - (j - 1))) % mod;
}
}
cout << dp[n][k - 1];
}
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... |