Cod sursa(job #2768293)

Utilizator robberttPopa Robert robbertt Data 10 august 2021 02:17:42
Problema Zoo Scor 30
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.79 kb
#include <iostream>
#include <fstream>
#include <vector>

using namespace std;

ifstream fin("zoo.in");
ofstream fout("zoo.out");

int n;
vector < pair <int, int> > points;

void solve(int x1, int y1, int x2, int y2){
    int inside = 0;
    for(int i = 0; i < n; ++i)
        if(points[i].first >= x1 && points[i].first <= x2 && points[i].second >= y1 && points[i].second <= y2)
            ++inside;
    fout << inside << endl;
}

int main(){
    int x, y;
    fin >> n;
    for(int i = 0; i < n; ++i){
        fin >> x >> y;
        points.push_back(make_pair(x, y));
    }
    int t, x1, x2, y1, y2;
    fin >> t;
    for(int i = 0; i < t; ++i){
        fin >> x1 >> y1 >> x2 >> y2;
        solve(x1, y1, x2, y2);

    }
    fin.close();
    fout.close();
    return 0;
}