# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1004063 |
2024-06-21T03:55:18 Z |
ef10 |
Kangaroo (CEOI16_kangaroo) |
C++17 |
|
0 ms |
348 KB |
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
typedef long long ll;
int n, a, b;
inline int add(int a, int b)
{
if(!b)
return a;
int x = a+b;
if(x >= mod)
x -= mod;
else
if(x < 0)
x += mod;
return x;
}
ll mul(ll a, ll b)
{
return (a * b) % mod;
}
ll dp[2002][2002];
int main()
{
std::ifstream input;
input.open("kangaroo.in");
std::ofstream output;
output.open("kangaroo.out");
input >> n >> a >> b;
dp[1][1] = 1;
for(int i = 2; i <= n; ++i)
for(int j = 1; j <= n; ++j)
{
if(i == a || i == b)
dp[i][j] = add(dp[i-1][j-1], dp[i-1][j]);
else
dp[i][j] = add(mul(dp[i-1][j+1], j), mul(dp[i-1][j-1], j - (i > a) - (i > b)));
}
output << dp[n][1];
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |