Cod sursa(job #1362819)

Utilizator PaueyPaula Nicoleta Gradu Pauey Data 26 februarie 2015 15:47:39
Problema A+B Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 1.06 kb
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

const int MAXN = 5000;

struct interv {
    int x1, x2, y1, y2;
};

struct point {
    int st, dr;
};

vector<point> px[MAXN];
interv I[MAXN];
vector<int> vx, vy;

int main()
{
    int N;
    cin >> N;
    for(int i = 0; i < N; ++i) {
        cin >> I[i].x1 >> I[i].y1 >> I[i].x2 >> I[i].y2;
        vx.push_back(I[i].x1);
        vx.push_back(I[i].x2);
        vy.push_back(I[i].y1);
        vy.push_back(I[i].y2);        
    }
    
    sort(vx.begin(), vx.end());
    vx.erase(unique(vx.begin(), vx.end()), vx.end());
    
    sort(vy.begin(), vy.end());
    vy.erase(unique(vy.begin(), vy.end()), vy.end());
    
    for(int i = 0; i < N; ++i) {
        I[i].x1 = lower_bound(vx.begin(), vx.end(), I[i].x1);
        I[i].x2 = lower_bound(vx.begin(), vx.end(), I[i].x2);
        I[i].y1 = lower_bound(vy.begin(), vy.end(), I[i].y1);
        I[i].y2 = lower_bound(vy.begin(), vy.end(), I[i].y2); 
        if(I[i].x1)       
    }
    
    return 0;
}