# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
49339 | 3zp | Kangaroo (CEOI16_kangaroo) | C++14 | 5 ms | 2232 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |