fork(1) download
  1. uses math;
  2. const fi='';
  3. fo='';
  4. maxn=1000;
  5. var a:array[1..maxn,1..maxn] of byte;
  6. i,j,m,n,res,top:longint;
  7. h,s,left,right:array[1..maxn] of integer;
  8. procedure nhap;
  9. begin
  10. assign(input,fi);reset(input);
  11. readln(m,n);
  12. for i:=1 to m do
  13. for j:=1 to n do read(a[i,j]);
  14. close(input);
  15. end;
  16. procedure push(x:integer);
  17. begin
  18. inc(top);
  19. s[top]:=x;
  20. end;
  21. function get:integer;
  22. begin
  23. exit(s[top]);
  24. end;
  25. procedure pop;
  26. begin
  27. dec(top);
  28. end;
  29. procedure xuly;
  30. begin
  31. for i:=1 to m do
  32. begin
  33. for j:=1 to n do
  34. if a[i,j]=1 then
  35. begin
  36. h[j]:=h[j]+1;
  37. end else h[j]:=0;
  38. top:=0;
  39. for j:=1 to n do
  40. begin
  41. while (top<>0) and (h[j]<=h[get]) do pop;
  42. if top=0 then left[j]:=0 else left[j]:=get;
  43. push(j);
  44. end;
  45. top:=0;
  46. for j:=n downto 1 do
  47. begin
  48. while (top<>0) and (h[j]<=h[get]) do pop;
  49. if top=0 then right[j]:=n+1 else right[j]:=get;
  50. push(j);
  51. end;
  52. for j:=1 to n do
  53. begin
  54. res:=max(res,h[j]*(right[j]-left[j]-1));
  55. end;
  56. end;
  57. end;
  58. procedure inkq;
  59. begin
  60. assign(output,fo);rewrite(output);
  61. writeln(res);
  62. close(output);
  63. end;
  64. begin
  65. nhap;
  66. xuly;
  67. inkq;
  68. end.
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.pas:1: warning: missing program header
prog.pas:1: error: module/unit interface `math' could not be imported
stdout
Standard output is empty