Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
960 B
2
Indexable
Never
#include <bits/stdc++.h>
#define endl '\n'
#define maxn 405
#define TASK bai1
#define For(i,a,b) for ( int i = a; i <= b; i++ )
#define Ford(i,a,b) for ( int i = a; i >= b; i-- )
#define MOD 100000000000007

using namespace std;
int a[maxn][maxn],m,n;
void inp()
{
    int d = 0;
    cin >> m >> n;
    For(i,1,m)
    For(j,1,n)
    cin >> a[i][j];
}
int Tinh(int x, int y)
{
    if(a[x][y] == 1) return 0;
    int u,v,res = 0;
    v = y;
    u = m;
    while(a[x][v] != 1 && v <= n)
    {
        int d = 0;
        For(i,x,m)
        if(a[i][v] != 1) d++; else break;
        u = min(d,u);
        res = max(res,u*(v - y + 1));
        v++;
    }
    return res;
}
int main()
{
    ios_base:: sync_with_stdio(0);
    cin.tie(0);
    if(fopen("bai1.inp","r")){
        freopen("bai1.inp","r",stdin);
    }
    inp();
    For(i,1,m)
    {
    For(j,1,n)
    cout << Tinh(i,j) << " ";
    cout << endl;
    }
}
Leave a Comment