Cod sursa(job #25482)

Utilizator bughyBondane Bogdan bughy Data 4 martie 2007 12:43:00
Problema Ograzi Scor 30
Compilator cpp Status done
Runda preONI 2007, Runda 3, Clasele 11-12 Marime 0.75 kb
#include <stdio.h>

#define input "ograzi.in"
#define output "ograzi.out"
#define dimmax 50001

struct ograzi
{
    long x,y;
}a[dimmax];

long n,m,w,h,rezultat;

int main()
{
        freopen(input,"r",stdin);
        freopen(output,"w",stdout);
        long i,j,x,y;
        scanf("%ld%ld%ld%ld",&n,&m,&w,&h);
        for(i=1;i<=n;i++)
          scanf("%ld%ld",&a[i].x,&a[i].y);
        for(j=1;j<=m;j++)
        {
          scanf("%ld%ld",&x,&y);
          for(i=1;i<=n;i++)
            if(x>=a[i].x && y>=a[i].y)
              if(x-a[i].x<=w && y-a[i].y<=h)
              {
                rezultat++;
                break;
              } 
        }       
        
        printf("%ld",rezultat);
        
        return 0;
}