Pagini recente » Cod sursa (job #2080811) | Cod sursa (job #1416166) | Cod sursa (job #225255) | Cod sursa (job #1686202) | Cod sursa (job #2629901)
#include <cstdio>
#include <vector>
#include <string>
using namespace std;
const int N = 1000 + 7;
int m, n, a[N], b[N], c[N], x[N], y[N], cnt = 1;
vector<int> who[N];
bool f(int i, int j) {
return (a[i] * (long long) x[j] + b[i] * (long long) y[j] + c[i] > 0);
}
int main() {
freopen ("regiuni.in", "r", stdin);
freopen ("regiuni.out", "w", stdout);
scanf("%d %d", &m, &n);
for (int i = 1; i <= m; i++) {
scanf("%d %d %d", &a[i], &b[i], &c[i]);
}
for (int i = 1; i <= n; i++) {
scanf("%d %d", &x[i], &y[i]);
who[1].push_back(i);
}
for (int i = 1; i <= m; i++) {
int cnt2 = cnt;
for (int it = 1; it <= cnt; it++) {
vector<int> a, b;
for (auto &j : who[it]) {
if (f(i, j)) {
a.push_back(j);
} else {
b.push_back(j);
}
}
if (a.empty() || b.empty()) {
continue;
}
who[it] = a;
who[++cnt2] = b;
}
cnt = cnt2;
}
printf("%d\n", cnt);
return 0;
}