# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
770377 | Sami_Massah | Kangaroo (CEOI16_kangaroo) | C++17 | 138 ms | 126332 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>
using namespace std;
const int maxn = 2000 + 12, mod = 1e9 + 7;
long long n, s, e, dp[maxn][maxn][4];
int main(){
cin >> n >> s >> e;
if(1 == s){
dp[1][1][1] = 1;
}
else if(e == 1){
dp[1][1][2] = 1;
}
else{
dp[1][1][0] = 1;
}
for(int i = 1; i <= n; i++){
for(int j = 1; j <= n; j++)
for(int c = 0; c < 4; c++){
// cout << i << ' ' << j << ' ' << c << ' ' << dp[i][j][c] << endl;
dp[i][j][c] %= mod;
if(i + 1 == s){
dp[i + 1][j][c | 1] += dp[i][j][c];
dp[i + 1][j + 1][c | 1] += dp[i][j][c];
}
else if(i + 1 == e){
dp[i + 1][j][c | 2] += dp[i][j][c];
dp[i + 1][j + 1][c | 2] += dp[i][j][c];
}
# | 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... |