Submission #312096

#TimeUsernameProblemLanguageResultExecution timeMemory
312096KriptonAsceticism (JOI18_asceticism)C++14
49 / 100
53 ms24952 KiB
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") using namespace std; const int MOD=1e9+7; int dp[3005][3005]; int main() { #ifdef HOME freopen("test.in","r",stdin); freopen("test.out","w",stdout); #endif // HOME ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int n,k,i,j; cin>>n>>k; dp[0][0]=1; for(i=0; i<=n; i++) for(j=0; j<=k; j++) { dp[i+1][j]=(dp[i+1][j]+1LL*j*dp[i][j])%MOD; dp[i+1][j+1]=(dp[i+1][j+1]+1LL*(i+1-j)*dp[i][j])%MOD; } cout<<dp[n][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...