Cod sursa(job #18166)

Utilizator recviemAlexandru Pana recviem Data 18 februarie 2007 10:18:03
Problema Plantatie Scor 50
Compilator fpc Status done
Runda preONI 2007, Runda 2, Clasa a 10-a Marime 0.69 kb
type productie=0..1000000000;
var plant:array[1..500,1..500] of ^productie;
    i,j,n:1..500;

procedure asignare;
begin
 assign(input,'plantatie.in');
 reset(input);
 assign(output,'plantatie.out');
 rewrite(output);
end;

procedure citire;
begin
 readln(n);
 for i:=1 to n do
 begin
  for j:=1 to n do
  begin
    new(plant[i,j]);
    read(plant[i,j]^);
  end;
  readln;
 end;
end;

procedure intrebare;
 var x,y,l:1..500;
     max:0..1000000000;
begin
 max:=0;
 readln(x,y,l);
 for i:=x to x+l-1 do
  for j:=y to y+l-1 do
   if plant[i,j]^>max then max:=plant[i,j]^;
writeln(max);
end;

begin
 asignare;
 citire;
 while not eof do intrebare;
 close(output);
end.