Submission #891887

#TimeUsernameProblemLanguageResultExecution timeMemory
891887boris_mihovAsceticism (JOI18_asceticism)C++17
49 / 100
1062 ms600 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...