Hello
can any one please explain problem D ..... i tried to solve it using DP but I dont know why my code make wrong answers
thanks
can any one please explain problem D ..... i tried to solve it using DP but I dont know why my code make wrong answers
thanks
#define LL long long
#define FI(i,a) for (int i=0; i<(a); ++i)
LL R( LL n, LL h)
{
if (m[n][40+h]!=-1) return m[n][40+h];
if (n==0)
{
if (h>0) return 0;
else return 1;
}
LL res=0;
FI(i,n)
res+=R(i,h-1)*R(n-i-1,0)+R(i,0)*R(n-i-1,h-1)-R(i,h-1)*R(n-i-1,h-1);
return m[n][40+h]=res;
}