Cod sursa(job #24972)

Utilizator CosminCosmin Negruseri Cosmin Data 4 martie 2007 06:02:47
Problema Ograzi Scor 30
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.62 kb
program ograzi_pas;
{$apptype console}
uses sysutils;
var fis:text;
    x, y:array[1..50000] of longint;
    W, H, n, i, j, m, num, xx, yy :longint;

begin
  assign(fis, 'ograzi.in');reset(fis);
  readln(fis, n, m, w, h);
  for i := 1 to n do readln(fis, x[i], y[i]);
  num := 0;
  for i := 1 to m do begin
    readln(fis, xx, yy);
    for j := 1 to n do
      if (xx >= x[j]) and (xx <= x[j] + w) and
         (yy >= y[j]) and (yy <= y[j] + h) then begin
         inc(num);
         break;
      end;
  end;
  close(fis);

  assign(fis, 'ograzi.out'); rewrite(fis);
  writeln(fis, num);
  close(fis);
end.