| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 96885 | Kastanda | 캥거루 (CEOI16_kangaroo) | C++11 | 2037 ms | 1096 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];
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 ++)
{
bool w = i & 1;
for (int st = 1; st <= i; st ++)
for (int fn = 1; fn <= i; fn ++)
if (fn != st)
{
dp[w][st][fn][0] = dp[w][st][fn][1] = 0;
// 0 :
for (int h = st + 1; h <= i; h ++)
if (h != fn)
dp[w][st][fn][0] = MOD(dp[!w][h-1][fn - (st < fn)][1] + dp[w][st][fn][0]);
// 1 :
for (int h = 1; h < st; h ++)
if (h != fn)
dp[w][st][fn][1] = MOD(dp[!w][h][fn - (st < fn)][0] + dp[w][st][fn][1]);
}
}
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... | ||||
