Cod sursa(job #20769)

Utilizator floringh06Florin Ghesu floringh06 Data 22 februarie 2007 09:50:09
Problema Plantatie Scor 50
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.5 kb
type smen=record x,y:longint; end;
var fi,fo:text;
    ii,jj,i,j,n,m,x,b,k,max:longint;
    a:array[1..505,1..505] of longint;



begin
assign(fi,'plantatie.in'); reset(fi);
assign(fo,'plantatie.out'); rewrite(fo);
readln(fi,n,m);
for i:=1 to n do
 for j:=1 to n do
  read(fi,a[i,j]);
readln(fi);
for i:=1 to m do
 begin
  readln(fi,x,b,k);
  max:=0;
  for ii:=x to x+k-1 do
   for jj:=b to b+k-1 do
    if a[ii,jj]>max then max:=a[ii,jj];
  writeln(fo,max);
 end;
close(fi);
close(fo);
end.