# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
96887 | Kastanda | 캥거루 (CEOI16_kangaroo) | C++11 | 3 ms | 640 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// I do it for the glory
#include<bits/stdc++.h>
using namespace std;
const int N = 205, Mod = 1e9 + 7;
int dp[2][N][N][2]; // 0 : to right , 1 : to left
int ps[N][N][2];
inline int MOD(int a)
{
if (a >= Mod) a -= Mod;
if (a < 0) a += Mod;
return a;
}
int main()
{
int n, s, f;
scanf("%d%d%d", &n, &s, &f);
dp[0][1][2][0] = dp[0][2][1][1] = 1;
for (int i = 3; i <= n; i ++)
{
int w = i & 1;
memset(ps, 0, sizeof(ps));
for (int st = 1; st <= i - 1; st ++)
for (int fn = 1; fn <= i - 1; fn ++)
{
ps[st][fn][0] = MOD(ps[st-1][fn][0] + dp[!w][st][fn][0]);
ps[st][fn][1] = MOD(ps[st-1][fn][1] + dp[!w][st][fn][1]);
}
for (int st = 1; st <= i; st ++)
for (int fn = st + 1; fn <= i; fn ++)
{
dp[w][st][fn][0] = MOD(ps[i-1][fn-1][1] - ps[st][fn-1][1]);
dp[w][st][fn][1] = ps[st-1][fn-1][0];
//dp[w][fn][st][0] = dp[w][st][fn][0];
//dp[w][fn][st][1] = dp[w][st][fn][1];
}
for (int fn = 1; fn <= i; fn ++)
for (int st = fn + 1; st <= i; st ++)
{
dp[w][st][fn][0] = dp[w][i - st + 1][i - fn + 1][1];
dp[w][st][fn][1] = dp[w][i - st + 1][i - fn + 1][0];
}
}
return !printf("%d\n", MOD(dp[n & 1][s][f][0] + dp[n & 1][s][f][1]));
}
컴파일 시 표준 에러 (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... |