Cod sursa(job #2801166)

Utilizator meinkampfEmanuel Pinzariu meinkampf Data 15 noiembrie 2021 11:47:32
Problema Regiuni Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.7 kb
#include <bits/stdc++.h>
using namespace std;

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

const int P = 45999139;
int n, m;
int a[1003][4];
unordered_set<int> M;

void Codare(int x, int y)
{
    int e = 0, i;
    for (i = 1; i <= n; i++)
    {
        if (a[i][1] * x + a[i][2] * y + a[i][3] > 0) e = (e * 2 + 1) % P;
        else e = (e * 2) % P;
    }
    M.insert(e);
}

void Citire()
{
    int i, x, y;
    fin >> n >> m;
    for (i = 1; i <= n; i++)
        fin >> a[i][1] >> a[i][2] >> a[i][3];
    for (i = 1; i <= m; i++)
    {
        fin >> x >> y;
        Codare(x, y);
    }
}

int main()
{
    Citire();
    fout << M.size();
    return 0;
}