Cod sursa(job #25481)

Utilizator the_mythTamas Andrei the_myth Data 4 martie 2007 12:42:55
Problema Ograzi Scor 30
Compilator fpc Status done
Runda preONI 2007, Runda 3, Clasele 11-12 Marime 0.69 kb
program ograda;
type vect=array[1..500]of word;
var f:text;
    x1,y1:vect;
    ok:boolean;
    n:word;
    i,j,m,w,h,x,y,c:longint;
begin
assign(f,'ograzi.in');
reset(f);
readln(f,n,m,w,h);
for i:=1 to n do
    begin
    readln(f,x,y);
    x1[i]:=x;
    y1[i]:=y;
    end;
for i:=1 to m do
    begin
    readln(f,x,y);
    ok:=false;
    j:=0;
    repeat
     inc(j);
     if (x>=x1[j]) and (x<=x1[j]+w)
        then if (y>=y1[j]) and (y<=y1[j]+h)
                then
                begin
                ok:=true;
                inc(c);
                end;
    until ok or (j=n);
    end;
close(f);
assign(f,'ograzi.out');
rewrite(f);
write(f,c);
close(f);
end.