제출 #551490

#제출 시각아이디문제언어결과실행 시간메모리
551490leakedKangaroo (CEOI16_kangaroo)C++17
0 / 100
1 ms340 KiB
#include <bits/stdc++.h>

#define f first
#define s second
#define m_p make_pair
#define vec vector
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pw(x) (1LL<<(x))
#define sz(x) (int)(x).size()

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int M=1e9+7;
void add(int &a,int b){
    a+=b;
    if(a>=M) a-=M;
    else if(a<0) a+=M;
}
int mult(int a,int b){
    return 1ll*a*b%M;
}
const int N=2e2+1;
int dp[N][N][N][2];
/// len,pos and last was left/right
signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n,x,y;
    cin>>n>>x>>y;--x;--y;
    dp[2][0][1][1]=1;
    dp[2][1][0][0]=1;
//    dp[1][0][0][0]=1;
//    dp[1][0][0][1]=1;
    for(int i=2;i<n;i++){
        for(int f=0;f<n;f++){
            int sm=0;
            for(int s=i;s>=0;s--){
                add(sm,dp[i][f][s][1]);
                dp[i+1][f+(s<=f)][s][0]=sm;
            }
            sm=0;
            for(int s=0;s<=i;s++){
                add(sm,dp[i][f][s][0]);
                dp[i+1][f+(s<=f)][s][1]=sm;
            }
        }
    }
    cout<<(dp[n][x][y][0]+dp[n][x][y][1])%M;
    return 0;
}
/*
5 14
3 7 1 5 10
1 3 5 7 10
11 2
aa
ab
aa
ca
aa
bc
ea
aa
ad
de
aa


*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...