Submission #789343

#TimeUsernameProblemLanguageResultExecution timeMemory
789343yeysoAsceticism (JOI18_asceticism)C++14
49 / 100
93 ms262144 KiB
#include <bits/stdc++.h> using namespace std; int main(){ long long n, k; cin >> n >> k; vector<vector<long long>> dp(n+1, vector<long long>(k+1, 0)); for(long long i = 0; i < n+1; i ++){ dp[i][0] = 1; if(i > 0) for(long long j = 1; j < k; j ++) dp[i][j] = ((dp[i-1][j-1] * (i - j)) % 1000000007ll + (dp[i-1][j] * (j + 1)) % 1000000007ll) % 1000000007ll; } cout << dp[n][k-1]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...