# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1088706 | Sunbae | Kangaroo (CEOI16_kangaroo) | C++17 | 33 ms | 31680 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll mod = 1e9 + 7;
ll dp[2001][2001];
signed main(){
int n, s, e; 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] + dp[i-1][j-1]) % mod;
}else{
dp[i][j] = (dp[i][j] + (dp[i-1][j+1] * j) % mod ) % mod;
dp[i][j] = (dp[i][j] + (dp[i-1][j-1] * max((j-(s<i)-(e<i)), 0)) % mod ) % mod;
}
}
}
printf("%lld", dp[n][1]);
}
Compilation message (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... |