Submission #49339

#TimeUsernameProblemLanguageResultExecution timeMemory
493393zpKangaroo (CEOI16_kangaroo)C++14
6 / 100
5 ms2232 KiB
#include<bits/stdc++.h> using namespace std; int dp[209][209][209][3]; main(){ int n,l,r; cin >> n >> l >> r; dp[1][1][1][1] = 1; dp[1][1][1][0] = 1; for(int N = 2; N <= n; N++){ for(int L = 1; L <= n; L++){ for(int R = 1; R <= n; R++){ for(int D = 0; D < 2; D++){ if(L == R) continue; if(D == 0){ for(int nL = L + 1; nL <= N; nL++){ int nR = R; if(R > L) nR--; dp[N][L][R][D] += dp[N - 1][nL - 1][nR][1 - D]; } } else { for(int nL = L - 1; nL >= 1; nL--){ int nR = R; if(R > L) nR--; dp[N][L][R][D] += dp[N - 1][nL][nR][1 - D]; } } } } } } cout << dp[n][l][r][0] + dp[n][l][r][1] << endl; }

Compilation message (stderr)

kangaroo.cpp:4:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...