Submission #960639

#TimeUsernameProblemLanguageResultExecution timeMemory
960639teo_thrashKangaroo (CEOI16_kangaroo)C++14
6 / 100
1 ms456 KiB
// it is your desire to work hard #include<bits/stdc++.h> #define pb push_back using namespace std; typedef long long ll; typedef pair<int, int> pii; const int maxn=2e3+3; const int mod=1e9+7; int n; int dp[maxn][maxn]; int cs, cf; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin>>n; cin>>cs>>cf; dp[1][1]=1; for(int i=2; i<=n; i++){ for(int j=1; j<=i; j++){ int rem=0; if(i>cs) rem++; if(i>cf) rem++; if(i==cs or i==cf){ dp[i][j] = dp[i-1][j-1] + dp[i-1][j]; }else{ dp[i][j] += dp[i-1][j+1]*j + dp[i-1][j-1]*(j-rem); } } } cout<<dp[n][1]<<endl; 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...