hdu6196 强行爆搜

#include
using namespace std;
typedef unsigned long long ll;
const int maxn=105;
const int inf=0x3f3f3f3f;
const int limit=0*CLOCKS_PER_SEC;
int dp_maxn[maxn][maxn],dp_minn[maxn][maxn],a[maxn],ans,start;
void dfs(int l,int r,int now)
{
    if(l>=r)
    {
        ans=max(ans,now);
        return;
    }
    if(now+dp_minn[l][r]>=0)
        return;
    if(now+dp_maxn[l][r]<=ans)
        return;
    if(now+dp_maxn[l][r]<0)
    {
        ans=max(ans,dp_maxn[l][r]+now);
        return;
    }
    if (clock()-start>limit)
        return;
    if(a[l]=a[i])
                {
                    dp_maxn[i-1-j*2][i]=max(-a[i-1-j*2]+a[i]+dp_maxn[i-j*2][i-1],-a[i-1-j*2]+a[i-j*2]+dp_maxn[i-j*2+1][i]);
                    dp_minn[i-1-j*2][i]=min(-a[i-1-j*2]+a[i]+dp_minn[i-j*2][i-1],-a[i-1-j*2]+a[i-j*2]+dp_minn[i-j*2+1][i]);
                }
                else if(a[i-1-j*2]-inf)
            printf("%d\n",-ans);
        else
            printf("The child will be unhappy...\n");
    }
    return 0;
}

你可能感兴趣的:(hdu6196 强行爆搜)