Pagini recente » Cod sursa (job #3363969) | Cod sursa (job #3362574) | Cod sursa (job #3362577) | Cod sursa (job #3363986) | Cod sursa (job #3364066)
#include <bits/stdc++.h>
using namespace std;
int w, h;
const int N = 1e7;
unordered_map <long long, pair<int, int>> dp;
bool check(int i, int j, int x, int y)
{
auto[lin, col] = dp[1LL * i * N + j];
if(x >= lin && x <= lin + w && y >= col && y <= col + h)
return true;
return false;
}
int main()
{
ifstream cin("ograzi.in");
ofstream cout("ograzi.out");
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n, m, i, j, x, y, k, oi = 0;
cin >> n >> m >> w >> h;
for(i = 0; i < n; i++)
{
cin >> x >> y;
dp[1LL * (x / w) * N + (y / h)] = {x, y};
}
for(k = 0; k < m; k++)
{
cin >> x >> y;
i = x / w;
j = y / h;
if(check(i, j, x, y) == true || check(i - 1, j, x, y) == true || check(i - 1, j - 1, x, y) == true || check(i, j - 1, x, y) == true)
oi++;
}
cout << oi;
return 0;
}