Pagini recente » Cod sursa (job #3226863) | Cod sursa (job #2791970) | Cod sursa (job #167559) | Cod sursa (job #1313191) | Cod sursa (job #2798923)
#include <bits/stdc++.h>
#define P 100002223
using namespace std;
ifstream fin("regiuni.in");
ofstream fout("regiuni.out");
int n, m;
struct D
{
int a, b, c;
}d[1005];
unordered_map<int, int> M;
int main()
{
fin >> n >> m;
for(int i =1; i <= n; i++)
fin >> d[i].a >> d[i].b >> d[i].c;
for(int i = 1; i <= m; i++)
{
int x, y, nr = 0;
fin >> x >> y;
for(int j = 1; j <= n; j++)
{
if((d[j].a*x + d[j].b*y + d[j].c) < 0)
nr = nr*2;
else nr = nr*2 + 1;
nr = nr % P;
}
M[nr]++;
}
int nrG = 0;
for(auto w : M)
if(w.second > 0)
nrG++;
fout << nrG;
return 0;
}