Pagini recente » Cod sursa (job #1893682) | Cod sursa (job #2618702) | Cod sursa (job #2891416) | Cod sursa (job #2895710) | Cod sursa (job #3040427)
#include <cmath>
#include <functional>
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <cassert>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <sstream>
#include <chrono>
#include <cstring>
#include <numeric>
using namespace std;
typedef long long ll;
const int MOD = 38461;
const int P = 100;
vector<pair<int, int>> mp[MOD];
int n, m, w, h;
int ret = 0;
int getcode(int x, int y) {
return (x * P + y) % MOD;
}
void baga(int nr, int x, int y) {
for (auto &it : mp[nr]) {
if (it.first <= x && x <= it.first + w && it.second <= y && y <= it.second + h) {
ret++;
return;
}
}
}
signed main() {
#ifdef INFOARENA
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
freopen("ograzi.in", "r", stdin);
freopen("ograzi.out", "w", stdout);
#else
FILE* stream;
freopen_s(&stream, "input.txt", "r", stdin);
#endif
cin >> n >> m >> w >> h;
for (int i = 1; i <= n; i++) {
int l, c;
cin >> l >> c;
mp[getcode(l / w + 1, c / h + 1)].push_back({l, c});
}
ret = 0;
for (int i = 1; i <= m; i++) {
int x, y;
cin >> x >> y;
baga(getcode(x / w + 1, y / h + 1), x, y);
baga(getcode(x / w, y / h + 1), x, y);
baga(getcode(x / w + 1, y / h), x, y);
baga(getcode(x / w, y / h), x, y);
}
cout << ret << "\n";
return 0;
}