#pragma GCC optimize("Ofast,unroll-loops,inline")
#include <bits/stdc++.h>
#pragma GCC target("avx2")
using namespace std;
using ll = long long;
const int M = 1e9 + 7;
int N, K;
ll dp[100000]{1};
int main() {
cin >> N >> K;
for (int n = 1; n <= N; ++n) {
for (int k = n - 1; k > 0; --k) {
dp[k] = (dp[k] * (k + 1) + dp[k - 1] * (n - k)) % M;
}
}
cout << dp[K - 1];
}
| # | 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... |