Cod sursa(job #2617580)

Utilizator CraniXortDumitrescul Eduard CraniXort Data 22 mai 2020 12:36:04
Problema Cadrane Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.88 kb
#include <bits/stdc++.h>
#define maxn 200005

std::ifstream fin ("cadrane_brute.in");
std::ofstream fout ("cadrane_brute.out");

struct point{
    int x, y;
}v[maxn];

int main()
{
    int n, i, j, k, x, y;
    fin >> n;
    for (i=0; i<n; i++)
        fin >> v[i].x >> v[i].y;

    int score, min=0, s;
    for (i=0; i<n; i++){
        score = 1e9;
        for (j=0; j<n; j++){
            y = v[i].y;
            x = v[j].x;
            s = 0;
            for (k=0; k<n; k++){
                if (v[k].x <= x and v[k].y <= y)
                    s ++;
                if (v[k].x >= x and v[k].y >= y)
                    s ++;
                if (v[k].x == x and v[k].y == y)
                    s --;
            }
            score = std::min (s, score);

        }
        min = std::max (min, score);
    }


    fout << min << '\n';

    return 0;
}