| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1354545 | uranhishig | Kangaroo (CEOI16_kangaroo) | C++20 | 12 ms | 23036 KiB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int mod = 1e9 + 7;
const int maxn = 2005;
int dp[maxn][maxn];
signed main(){
int n, cs, cf;
cin >> n >> cs >> cf;
dp[0][0] = 1;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= i; j++) {
if (i == cs || i == cf) {
dp[i][j] = (dp[i - 1][j - 1] + dp[i - 1][j]) % mod;
}
else {
int x = j - (i > cs) - (i > cf);
int y = (dp[i - 1][j - 1] * x) % mod;
int z = (dp[i - 1][j + 1] * j) % mod;
dp[i][j] = (y + z) % mod;
}
}
}
cout << dp[n][1] << endl;
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
