hdu 1505 City Game

#include
#include
using namespace std;
const int maxn = 1000;
int mat[maxn][maxn],up[maxn][maxn],left[maxn][maxn],right[maxn][maxn];
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int m,n;
        scanf("%d%d",&m,&n);
        for(int i=0;i=0;j--)
                {
                    if(mat[i][j]==1)
                    {
                        right[i][j]=n;
                        ro=j;
                    }
                    else
                    {
                        right[i][j]=i==0?ro-1:min(right[i-1][j],ro-1);
                        ans=max(ans,up[i][j]*(right[i][j]-left[i][j]+1));
                    }
                }
        }
        printf("%d\n",ans*3);
    }
    return 0;
}

你可能感兴趣的:(hdu)