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 <algorithm>
#include <iostream>
#include <numeric>
#include <cassert>
#include <vector>
typedef long long llong;
const int MAXN = 100000 + 10;
const int MOD = 1e9 + 7;
int n, k;
int dp[MAXN];
int newDP[MAXN];
void solve()
{
dp[0] = 1;
for (int i = 2 ; i <= n ; ++i)
{
for (int j = i ; j >= 1 ; --j)
{
dp[j] = (1LL * dp[j] * (j + 1) + 1LL * dp[j - 1] * (i - j)) % MOD;
}
// for (int j = 0 ; j < i ; ++j)
// {
// std::cout << dp[j] << ' ';
// }
// std::cout << '\n';
}
std::cout << dp[k - 1] << '\n';
}
void input()
{
std::cin >> n >> k;
}
void fastIOI()
{
std::ios_base :: sync_with_stdio(0);
std::cout.tie(nullptr);
std::cin.tie(nullptr);
}
int main()
{
fastIOI();
input();
solve();
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... |