Cod sursa(job #18383)

Utilizator ldocPopDragos ldoc Data 18 februarie 2007 11:51:41
Problema Plantatie Scor 50
Compilator fpc Status done
Runda preONI 2007, Runda 2, Clasa a 10-a Marime 0.52 kb
var max,i,j,n,m,lin,col,lung:longint;
    mat:array [1..500,1..500] of longint;
begin
 assign (input,'plantatie.in'); reset (input);
 assign (output,'plantatie.out'); rewrite (output);
  readln (n,m);
  for i:=1 to n do begin
   for j:=1 to n do read (mat[i,j]);
   readln;
  end;
  while m>0 do begin max:=0;
   readln (lin,col,lung);
   for i:=lin to lin+lung-1 do
    for j:=col to col+lung-1 do
     if mat[i,j]>max then max:=mat[i,j];
   writeln (max); dec (m);
  end;
 close (input); close (output);
end.