Guest User

Untitled

a guest
Jul 22nd, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.76 KB | None | 0 0
  1. var
  2.     A: array[1..100, 1..100] of integer;
  3.     n, m, i, j, k, l, res, x1, y1, x2, y2: integer;
  4.     good: boolean;
  5. begin
  6.     read(n, m);
  7.     for i := 1 to n do begin
  8.         for j := 1 to m do
  9.             read(A[i, j]);
  10.     end;
  11.  
  12.     res := -1;
  13.     for i := 1 to n do begin
  14.         for j := 1 to n do begin
  15.             good := true;
  16.             for k := i to n do begin
  17.                 for l := j to n do begin
  18.                     if (A[i, j] <> 1) then begin
  19.                         good := false;
  20.                     end;
  21.                 end;
  22.             end;
  23.  
  24.             if good and ((k - i + 1) * (l - j + 1) > res) then begin
  25.                 res := (k - i + 1) * (l - j + 1);
  26.                 x1 := i;
  27.                 y1 := j;
  28.                 x2 := k;
  29.                 y2 := l;
  30.             end;
  31.         end;
  32.     end;
  33.  
  34.     if (res = -1) then begin
  35.         writeln('it''s boring :(');
  36.     end
  37.     else begin
  38.         writeln(res);
  39.         writeln(x1, ' ', y1, ' ', x2, ' ', y2);
  40.     end;
  41.     readln;
  42. end.
Add Comment
Please, Sign In to add comment