比赛 10101115 评测结果 WWWWWTTTTT
题目名称 牛宫 最终得分 0
用户昵称 ybh 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2010-11-15 09:43:13
显示代码纯文本
{牛宫
 数值递推 or 动态规划
 Author: yangbohua
 Time: 2010-11-15 09:46}

program long;
var
  a,s:array[0..201,0..201] of longint;
  n,m,i,j,i1,j1,sum,temp,ans:longint;

begin
  assign(input,'long.in');
  reset(input);
  assign(output,'long.out');
  rewrite(output);
  readln(n,m);
  for i:=1 to n do
    for j:=1 to m do
      read(a[i,j]);
  for i:=1 to n do
  begin
    sum:=0;
    for j:=1 to m do
    begin
      sum:=sum+a[i,j];
      s[i,j]:=s[i-1,j]+sum;
    end;
  end;
  ans:=0;
  for i:=n downto 1 do
    for j:=m downto 1 do
      for i1:=1 to i do
        for j1:=1 to j do
        begin
          temp:=s[i,j]-s[i1-1,j]-s[i,j1-1]+s[i1-1,j1-1];
          if (temp>0) and ((i-i1+1)*(j-j1+1)>ans)
            then ans:=(i-i1+1)*(j-j1+1);
        end;
  writeln(ans);
  close(input);
  close(output)
end.