# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1004065 |
2024-06-21T04:12:41 Z |
ef10 |
Kangaroo (CEOI16_kangaroo) |
C++17 |
|
0 ms |
344 KB |
// Source: https://usaco.guide/general/io
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define MODULE 1000000007
int main() {
std::ifstream input;
input.open("kangaroo.in");
std::ofstream output;
output.open("kangaroo.out");
LL N, s, f;
input >> N >> s >> f;
LL ep = 0;
LL dp[N+5][N+5]; memset(dp,0,sizeof(dp));
dp[1][1] = 1;
if (s==1 || f==1) {
ep++;
}
for (LL i = 2; i <= N; i++) {
for (LL j = 1; j <= N; j++) {
if (i == s || i == f) {
if (j == 1) ep++;
dp[i][j] += dp[i-1][j-1];
dp[i][j] %= MODULE;
dp[i][j] += dp[i-1][j];
dp[i][j] %= MODULE;
continue;
}
if (j-ep > 0) {
dp[i][j] += (dp[i-1][j-1] * (j-ep)) % MODULE;
dp[i][j] %= MODULE;
}
dp[i][j] += (dp[i-1][j+1]*j) % MODULE;
dp[i][j] %= MODULE;
}
}
output << dp[N][1] << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |