Cod sursa(job #24971)

Utilizator CosminCosmin Negruseri Cosmin Data 4 martie 2007 05:41:40
Problema Ograzi Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.63 kb
program ograzi_pas;
{$apptype console}
uses sysutils;
var fis:text;
    x, y:array[1..50000] of longint;
    W, H, sqrtn, 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[i]) and (xx <= x[i] + w) and
         (yy >= y[i]) and (yy <= y[i] + h) then begin
         inc(num);
         break;
      end;
  end;
  close(fis);

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