Pagini recente » Cod sursa (job #575538) | Cod sursa (job #2565955) | Cod sursa (job #2872160) | Cod sursa (job #89408) | Cod sursa (job #3291783)
#include <fstream>
#include <unordered_map>
#include <vector>
using namespace std;
struct elem{
int x, y;
};
unordered_map <int, unordered_map <int, int>> f;
vector <elem> v;
int w, h;
int check(int x, int y, int poz){
if( v[poz].x + w >= x && v[poz].y + h >= y ){
return 1;
}
return 0;
}
int main(){
int n, m, i, x, y, r, ad;
ifstream fin( "ograzi.in" );
ofstream fout( "ograzi.out" );
fin >> n >> m >> w >> h;
for( i = 0; i < n; i++ ){
fin >> x >> y;
v.push_back( { x, y } );
f[x / w][y / h] = i;
}
r = 0;
for( i = 0; i < m; i++ ){
fin >> x >> y;
ad = max( check( x, y, f[x / w][y / h] ), check( x, y, f[x / w - 1][y / h] ) );
ad = max( check( x, y, f[x / w][y / h - 1] ), ad );
ad = max( check( x, y, f[x / w - 1][y / h - 1] ), ad );
}
fout << r;
return 0;
}