Cod sursa(job #2669946)

Utilizator PatrickCplusplusPatrick Kristian Ondreovici PatrickCplusplus Data 8 noiembrie 2020 15:10:58
Problema Zoo Scor 30
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.66 kb
#include <bits/stdc++.h>

using namespace std;

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

int n, m;
pair <int, int> v[16006];
int main(){
    fin >> n;
    for (int i = 1; i <= n; ++i){
        fin >> v[i].first >> v[i].second;
    }
    fin >> m;
    for (int i = 1; i <= m; ++i){
        int a, b, c, d;
        fin >> a >> b >> c >> d;
        int contor = 0;
        for (int j = 1; j <= n; ++j){
            if (a <= v[j].first && v[j].first <= c && b <= v[j].second && v[j].second <= d){
                ++contor;
            }
        }
        fout << contor << "\n";
    }
    fin.close();
    fout.close();
    return 0;
}