Pagini recente » Cod sursa (job #291817) | Cod sursa (job #1504985) | Cod sursa (job #3001091) | Cod sursa (job #1340211) | Cod sursa (job #2496174)
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;
ifstream cin("ograzi.in");
ofstream cout("ograzi.out");
#define MAXN 50005
struct coord
{
int x;
int y;
} coords[MAXN];
bool Compare(coord vala, coord valb)
{
return vala.x < valb.x;
}
int main()
{
int n, m, w, h;
int ans = 0;
cin >> n >> m >> w >> h;
int x, y;
for(int i = 0; i < n; i++)
{
cin >> coords[i].x >> coords[i].y;
}
sort(coords+1, coords+n, Compare);
for(int i = 0; i < m; i++)
{
int x, y;
cin >> x >> y;
for(int i = 0; i < n; i++)
{
if(coords[i].x <= x && x <= coords[i].x + w)
{
if(coords[i].y <= y && y <= coords[i].y + h)
{
ans++;
break;
}
}
if(x < coords[i].x)
break;
}
}
cout << ans;
return 0;
}