Submission #1109618

#TimeUsernameProblemLanguageResultExecution timeMemory
1109618sinataghizadehKangaroo (CEOI16_kangaroo)C++17
51 / 100
1442 ms235436 KiB
#include <bits/stdc++.h>
using namespace std;


typedef long long       ll;
typedef pair<int, int>  pii;
typedef pair<ll, ll>  pll;
#define all(x)			(x).begin(),(x).end()
#define pb    			push_back
#define fi              first
#define se              second
#define mp make_pair
#define beg             begin
#define siz              size()
#define fastio          cin.tie(NULL); cout.tie(NULL); ios_base::sync_with_stdio(false);
#define endl       		'\n'
#define ins             insert
#define log             LOG
const ll inf = 1e16;
const ll mod = 1e9+7;
const int maxn=200+44;
const int log=24;
const int delta=229939;
ll dp[maxn][maxn][maxn][2];
ll n,cs,cf;
int main(){
	fastio
    cin>>n>>cs>>cf;
    dp[1][1][1][0]=1;
	dp[1][1][1][1]=1;
	for (int i=2;i<=n;i++){
		for (int j=1;j<=i;j++){
			for (int k=1;k<=i;k++){
				if(j==k)continue;
				for(int l=1;l<k;l++){//cout<<"DKJFJF";
					dp[i][j][k][1]+=dp[i-1][j-(k<=j)][l][0];
					if (dp[i][j][k][1]>=mod)dp[i][j][k][1]-=mod;
				}
				for(int l=k;l<=i;l++){
					dp[i][j][k][0]+=dp[i-1][j-(k <= j)][l][1];
					if (dp[i][j][k][0]>=mod)dp[i][j][k][0]-=mod;
				}
			///	cout<<i<<" "<<j<<" "<<mod<<endl;
			//	cout<<i<<" "<<j<<" "<<k<<dp[i][j][k]<<endl;
			}
		}
	}
	cout<<(dp[n][cs][cf][0]+dp[n][cs][cf][1])%mod<<endl;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...