# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
442635 | parsabahrami | 캥거루 (CEOI16_kangaroo) | C++17 | 39 ms | 15976 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/* I do it for the glory */
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
#define SZ(x) (int) x.size()
#define F first
#define S second
const int N = 2e3 + 10, MOD = 1e9 + 7;
int n, s, e, dp[N][N];
int main() {
scanf("%d%d%d", &n, &s, &e);
dp[1][1] = 1;
for (int i = 2; i <= n; i++) {
for (int j = 1; j <= n; j++) {
if (i == s || i == e) dp[i][j] = (dp[i - 1][j - 1] + dp[i - 1][j]) % MOD;
else {
int x = j;
if (i > s) x--;
if (i > e) x--;
dp[i][j] = (1ll * dp[i - 1][j + 1] * j % MOD + dp[i - 1][j - 1] * 1ll * x % MOD) % MOD;
}
}
}
printf("%d\n", dp[n][1]);
return 0;
}
컴파일 시 표준 에러 (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... |