답안 #49339

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
49339 2018-05-26T09:11:26 Z 3zp 캥거루 (CEOI16_kangaroo) C++14
6 / 100
5 ms 2232 KB
#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

kangaroo.cpp:4:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
3 Incorrect 5 ms 2232 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
3 Incorrect 5 ms 2232 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
3 Incorrect 5 ms 2232 KB Output isn't correct
4 Halted 0 ms 0 KB -