记录编号 21786 评测结果 WWWWWTTWTW
题目名称 牛宫 最终得分 0
用户昵称 GravatarZhouZn1 是否通过 未通过
代码语言 Pascal 运行时间 4.167 s
提交时间 2010-11-15 15:00:00 内存使用 0.57 MiB
显示代码纯文本
program zzn;
var
        m,n,i,j,s,k,ans:longint;
        f:array[0..200,0..200]of longint;
        sn:array[1..200,0..200]of longint;
        map:array[0..201,0..201]of longint;
procedure init;
begin
        assign(input,'long.in');
        reset(input);
        assign(output,'long.out');
        rewrite(output);
        readln(n,m);
        fillchar(f,sizeof(f),0);
        fillchar(sn,sizeof(sn),0);
        for i:=1 to n do
        begin
            for j:=1 to m do
            begin
            read(map[i,j]);
            sn[i,j]:=sn[i,j-1]+map[i,j];
            end;
        end;
        for i:=1 to n do
         begin
             for j:=1 to m do
             begin
                  s:=0;
                  for k:=1 to i do
                  begin
                      s:=s+sn[k,j];
                  end;
                  f[i,j]:=s;
             end;
         end;
end;
procedure closef;
begin
        close(input);
        close(output);
end;
function sum(x1,y1,x2,y2:integer):longint;
var
        s:longint;
begin
        s:=f[x2,y2]-f[x1-1,y2]-f[x2,y1-1]+f[x1-1,y1-1];
        exit(s);
end;
procedure  main;
var
        x1,x2,y1,y2:integer;
begin
        ans:=0;
        if (f[n,m]>0) then
        begin
        writeln(n*m);
        exit;
        end;
        for x1:=1 to n do
         for y1:=1 to m do
          for x2:=n downto x1 do
           for y2:=m downto y1 do
            begin
                if sum(x1,y1,x2,y2)>=0 then
                begin
                    if (x2-x1+1)*(y2-y1+1)>ans then
                    begin
                    ans:=(x2-x1+1)*(y2-y1+1);
                    end;
                end;
            end;
         writeln(ans);
end;
begin
        init;
        main;
        closef;
end.