Pagini recente » Cod sursa (job #184200) | Cod sursa (job #494917) | Cod sursa (job #52113) | Cod sursa (job #821107) | Cod sursa (job #2368292)
#include <fstream>
#include <vector>
using namespace std;
ifstream cin ("regiuni.in");
ofstream cout ("regiuni.out");
struct Cf {
int a, b, c;
};
struct Punct {
int x, y;
};
int n, m, g, lst;
Cf v[1005];
Punct p[1005];
vector <Punct> s[16005];
bool susDreapta(Punct p, Cf d) {
return (p.x * d.a + p.y * d.b + d.c > 0);
}
void divGrup(vector <Punct> gp, Cf d) {
bool ok1 = 0, ok2 = 0;
for(auto i : gp) {
if(susDreapta(i, d)) {
if(!ok1)
g++, ok1 = 1;
s[g].push_back(i);
} else {
if(!ok2)
g++, ok2 = 1;
s[g].push_back(i);
}
}
}
int main() {
cin >> n >> m;
for(int i = 1; i <= n; i++)
cin >> v[i].a >> v[i].b >> v[i].c;
g = lst = 1;
for(int i = 1; i <= m; i++) {
cin >> p[i].x >> p[i].y;
s[1].push_back(p[i]);
}
for(int i = 1; i <= n; i++) {
int g2 = g;
for(int j = lst; j <= g2; j++)
divGrup(s[j], v[i]);
lst = g2 + 1;
}
cout << g - lst + 1;
return 0;
}