Cod sursa(job #1232968)

Utilizator assa98Andrei Stanciu assa98 Data 24 septembrie 2014 13:21:55
Problema Zoo Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 1.8 kb
#include <fstream>
#include <algorithm>
#include <vector>

#define pe pair<int, int>
#define mp make_pair
#define fi first
#define se second

using namespace std;

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

const int MAX_N = 16100;
const int MAX_M = 100100;
const int INF = 2000000000;

vector<int> x;
vector<int> y;

vector<pe> A;
vector<pair<pe, pe> > Q;

struct NOD {
    vector<int> v;
    vector<int> pl;
    vector<int> pr;
};

void merge_nod(NOD &a, NOD &b, NOD &c) {
    a.v.clear();
    a.pl.clear();
    v.pr.clear();

    int poz1 = 0;
    int poz2 = 0;
    vector<int> &v1 = b.v;
    vector<int> &v2 = c.v;
    while(poz1 < v1.size() && poz2 < v2.size()) {
        a.pl.push_back(poz1);
        a.pr.push_back(poz2);

        if(v1[poz1] < v2[poz2]) {
            a.v.push_back(v1[poz1]);
            poz1++;
        }
        else {
            a.v.push_back(v2[poz2]);
            poz2++;
        }
    }
}

int query(int x1, int x2, int y1, int y2) {
    return 0;
}

int main() {
    int n, m;
    fin >> n;
    for(int i = 1; i <= n; i++) {
        int a, b;
        fin >> a >> b;
        A.push_back(mp(a, b));
        x.push_back(a);
        y.push_back(b);
    }



    x.push_back(-INF - 1);
    y.push_back(-INF - 1);
    sort(x.begin(), x.end());
    sort(y.begin(), y.end());
    x.erase(unique(x.begin(), x.end()), x.end());
    y.erase(unique(y.begin(), y.end()), y.end());

    for(auto it : A) {
        int a = lower_bound(x.begin(), x.end(), it.fi) - x.begin();
        int b = lower_bound(y.begin(), y.end(), it.se) - y.begin();

    }


    fin >> m;
    for(int i = 1; i <= m; i++) {
        int x1, x2, y1, y2;
        fin >> x1 >> y1 >> x2 >> y2;
        fout << query(x1, x2, y1, y2);
    }

    return 0;
}