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;
#define ll long long
#define pb push_back
#define fr first
#define sc second
#define ARRS ((ll)(2e6+500))
#define MAX ((ll)(1e9+100))
#define MOD ((ll)1e9+7)
#define mi(a,b) a=min((a),(b))
ll n,m,k,p,l,r,q;
ll a[ARRS];
ll c;
string s,t;
ll dp[210][210][210][2];
ll go(ll n,ll l,ll r,ll w){
if(dp[n][l][r][w])return dp[n][l][r][w]-1;
if(l==r&&n==1)return 1;
else if(l==r)return 0;
ll p=0;
if(w){
for(int i=l+1; i<=n; i++)
p+=go(n-1,i-1,r-(l<r),w^1);
}
else {
for(int i=1; i<l; i++)
p+=go(n-1,i,r-(l<r),w^1);
}
p%=MOD;
dp[n][l][r][w]=p+1;
return p;
}
int main(){
#ifdef KHOKHO
freopen("in.in","r",stdin);
freopen("out.out","w",stdout);
#endif
cin>>n>>l>>r;
cout<<go(n,l,r,0)+go(n,l,r,1);
}
# | 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... |