需要注意在输入直线的参数时的输入顺序
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <stack>
#include <cstring>
#include <math.h>
#define MAX 1100
using namespace std;
struct Node
{
int w, y;
char t;
} node[MAX];
struct line
{
int x1, x2, x3;
} l[20];
int main()
{
int n, m;
cin >> n >> m;
for (int i = 0; i < n; i++)
{
cin >> node[i].w >> node[i].y >> node[i].t;
}
for (int i = 0; i < m; i++)
{
char A = 'n';
char B = 'n';
bool flag = true;
cin >> l[i].x3 >> l[i].x1 >> l[i].x2;
for (int j = 0; j < n; j++)
{
int z = l[i].x3 + l[i].x1 * node[j].w + l[i].x2 * node[j].y;
if (z > 0)
{
if (A == 'n')
{
A = node[j].t;
}
else if (A != node[j].t)
{
flag = false;
}
}
else
{
if (B == 'n')
{
B = node[j].t;
}
else if (B != node[j].t)
{
flag = false;
}
}
}
if (flag)
{
cout << "Yes" << endl;
}
else if(!flag)
{
cout << "No" << endl;
}
}
}