Cod sursa(job #52292)

Utilizator gabitzish1Gabriel Bitis gabitzish1 Data 18 aprilie 2007 15:32:59
Problema Ograzi Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.66 kb
#include<fstream.h>

long a[100][100];
typedef struct
{
  long x, y;
} Punct;
long w, h, n, m;

Punct oi[100000], d[50000];

long cautare(int a, int b)
{
  if ((d[a].x+h)>=oi[b].x && oi[b].x>=d[a].x
      && d[a].y<=oi[b].y && oi[b].y<=(d[a].y+w)) return 1;
  return 0;
}


void calcul()
{
  long i, j, contor=0;
  ifstream in("ograzi.in");
  in>>n>>m>>w>>h;
  for (i=1; i<=n; i++)
    in>>d[i].x>>d[i].y;
  for (i=1; i<=m; i++)
    { in>>oi[i].x>>oi[i].y;
      for (j=1; j<=n; j++)
	 contor+=cautare(j,i);
    }
  ofstream out("ograzi.out");
  out<<contor;
  in.close();
  out.close();
}


int main()
{
  calcul();
  return 0;
}