| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 515764 | CraniXort | 캥거루 (CEOI16_kangaroo) | C++17 | 36 ms | 31680 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define fin std::cin
#define fout std::cout
int main(){
std::ios_base::sync_with_stdio(false);
std::cin.tie(NULL);
std::cout.tie(NULL);
int n, start, stop, flag = 0;
fin >> n >> start >> stop;
long long mod = 1000000007;
long long dp[n+2][n+2] = {};
dp[0][0] = 1;
for(int i = 1; i <= n; i ++) {
if(i == start or i == stop)
flag ++;
for(int j = 1; j <= i; j ++) {
if(i == start or i == stop) {
dp[i][j] = (dp[i-1][j-1] + dp[i-1][j]) % mod;
continue;
}
dp[i][j] = (dp[i-1][j-1] * (j - flag) + dp[i-1][j+1] * j) % mod;
}
}
fout << dp[n][1] << '\n';
return 0;
}| # | 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... | ||||
