General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
81876518 Practice:
apoorva222g
1288C - 5 GNU C++17 Time limit exceeded on test 3 1000 ms 86284 KB 2020-05-29 14:00:07 2020-05-29 14:00:08
 
 
→ Source
#include<bits/stdc++.h> 
using   namespace std;
typedef long long int ll;
#define fo(i,s,e_ex) for(i=s;i<e_ex;i++)
#define Fo(i,k,n) for(i=k;k<n?i<=n:i>=n;k<n?i+=1:i-=1)
#define endl '\n'
#define MOD 1000000007//998244353
#define pbb push_back
#define mpp make_pair
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define mset(arr,val) memset(arr,val,sizeof(arr))
ll dp[11][1001][1001];
ll findAns(ll idx,ll lasta,ll lastb,ll m){
	if(idx==m) return 1;
	if(dp[idx][lasta][lastb]>-1) {
		//cout<<idx<<" "<<lasta<<" "<<lastb<<" "<<dp[idx][lasta][lastb]<<endl;
		//cout<<"hi"<<endl;
		return dp[idx][lasta][lastb];
	}
	ll myans=0;
	ll i,j;
	for(i=lasta;i<=lastb;i++){
		for(j=i;j<=lastb;j++){
			myans=(myans+findAns(idx+1,i,j,m))%MOD;
		}
	}
	//cout<<idx<<" "<<lasta<<" "<<lastb<<" "<<dp[idx][lasta][lastb]<<endl;
	return dp[idx][lasta][lastb]=myans;
}
void solve(){
	ll i,j,n,m;
	cin>>n>>m;
	mset(dp,-1);
	ll ans=0;
	//for(i=1;i<=n;i++){
		//for(j=i;j<=n;j++){
			//ans=(ans+1+findAns(1,i,j,m))%MOD;
		//}
	//}
	ans = findAns(0,1,n,m);
	cout<<ans<<endl;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	ll t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
	return 0;
}
 
 
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details