Submission #807113

#TimeUsernameProblemLanguageResultExecution timeMemory
807113LucaIlieAsceticism (JOI18_asceticism)C++17
49 / 100
836 ms340 KiB
#include <bits/stdc++.h> using namespace std; const int MAX_K = 1e5; const int MOD = 1e9 + 7; int dp[MAX_K + 1]; int main() { int n, k; cin >> n >> k; dp[1] = 1; for ( int i = 2; i <= n; i++ ) { for ( int j = k; j >= 1; j-- ) dp[j] = ((long long)dp[j] * j + (long long)dp[j - 1] * (i - j + 1)) % MOD; } cout << dp[k]; 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...