# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
49342 | 3zp | 캥거루 (CEOI16_kangaroo) | C++14 | 1832 ms | 425624 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
int dp[209][209][209][3];
int prefdp[209][209][209][3];
int mod = 1e9+ 7;
main(){
int n,l,r;
cin >> n >> l >> r;
dp[1][1][1][1] = 1;
dp[1][1][1][0] = 1;
prefdp[1][1][1][1] = 1;
prefdp[1][1][1][0] = 1;
for(int N = 2; N <= n; N++){
for(int L = 1; L <= n; L++){
for(int R = max(0,r - (n - N)); R <= r; R++){
for(int D = 0; D < 2; D++){
if(L != R){
int nR = R;
if (R > L) nR--;
if(D == 0){
dp[N][L][R][D] += prefdp[N-1][N-1][nR][1-D] - prefdp[N-1][L-1][nR][1-D] + mod;
while (dp[N][L][R][D] > mod) dp[N][L][R][D]-=mod;
}
else {
dp[N][L][R][D] += prefdp[N-1][L-1][nR][1-D];
while (dp[N][L][R][D] > mod) dp[N][L][R][D]-=mod;
}
}
prefdp[N][L][R][D] = prefdp[N][L-1][R][D] + dp[N][L][R][D];
if( prefdp[N][L][R][D] > mod) prefdp[N][L][R][D] -= mod;
}
}
}
}
cout << (dp[n][l][r][0] + dp[n][l][r][1]) % mod << endl;
}
컴파일 시 표준 에러 (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... |