Submission #752606

#TimeUsernameProblemLanguageResultExecution timeMemory
752606bgnbvnbvAsceticism (JOI18_asceticism)C++14
49 / 100
84 ms94396 KiB
#include<bits/stdc++.h> #define TASKNAME "codeforce" #define pb push_back #define pli pair<int,int> #define fi first #define se second #define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); using namespace std; using ll=long long; const ll maxN=2e5; const ll inf=1e18; const ll mod=1e9+7; ll dp[3005][3005],n,k; void solve() { cin >> n >> k; dp[1][0]=1; for(int i=2;i<=n;i++) { for(int j=0;j<=i-1;j++) { dp[i][j]=(j+1)*dp[i-1][j]; if(j-1>=0) dp[i][j]+=(i-j)*dp[i-1][j-1]; dp[i][j]%=mod; } } cout << dp[n][k-1]%mod; } int main() { fastio //freopen(TASKNAME".INP","r",stdin); //freopen(TASKNAME".OUT","w",stdout); solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...