Cod sursa(job #19243)

Utilizator Adrian001Vladulescu Adrian Adrian001 Data 18 februarie 2007 23:05:39
Problema Plantatie Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.52 kb
Program cel;
Type metrice=array[1..500,1..500] of longint;
var f,g:text;
    a:matrice;
    n,i,j,k,ii,jj:integer;
    m,p,max:longint;
Begin
Assign(f,'plantatie.in');Reset(f);
Assign(g,'plantatie.out');Rewrite(g);
Readln(f,n,m);
For i:=1 to n do
 Begin
  For j:=1 to n do Read(f,a[i,j]);
  Readln(f);
 end;
For p:=1 to m do
 Begin
  Readln(f,i,j,k);
  max:=-1;
  For ii:=i to i+k-1 do
   For jj:=j to j+k-1 do
    If max<a[ii,jj] then max:=a[ii,jj];
   Writeln(g,max);
  end;
Close(f);
Close(g);
end.