#include<iostream>
#include<algorithm>
#include<string.h>
#include<cstdio>
using namespace std;
const int maxn = 5e4 + 100;
#define TLE ios::sync_with_stdio(0),cin.tie(0)
const int INF = 0x3f3f3f3f;
int x[maxn], y[maxn];
char s[maxn];
int main() {
TLE;
int n, m, a, b, c;
cin >> n >> m;
for (int i = 0; i < n; i++)
cin >> x[i] >> y[i] >> s[i];
for (int i = 0; i < m; i++) {
cin >> a >> b >> c;
int A, B, t = 1;
if ((a + b * x[0] + c * y[0] > 0&&s[0] == 'A')
|| (a + b * x[0] + c * y[0] < 0 && s[0] == 'B'))
A = 1, B = -1;
else A = -1, B = 1;
for (int j = 1; j < n; j++) {
if (s[j] == 'A') {
if (((a + b * x[j] + c * y[j]) * A) > 0)
t++;
else break;
}
else if (s[j] == 'B') {
if (((a + b * x[j] + c * y[j]) * B) > 0)
t++;
else break;
}
}
if (n == t) cout << "Yes" << endl;
else cout << "No" << endl;
}
return 0;
}
CCF 202006-1 线性分类器
最新推荐文章于 2022-10-30 18:33:06 发布