源代码如下:
#include<iostream>
using namespace std;
typedef struct {
int x;
int y;
char t;
}stru1;
typedef struct {
int x;
int y;
int z;
}stru2;
int main(){
int n,m;
cin>>n>>m;
stru1 a[n];
stru2 b[m];
for(int i=1;i<=n;i++)
cin>>a[i].x>>a[i].y>>a[i].t;
for(int j=1;j<=m;j++)
cin>>b[j].x>>b[j].y>>b[j].z;
for(int j=1;j<=m;j++){
int flag=1;
char temp;
int onto;
temp=a[1].t;
onto=b[j].x+a[1].x*b[j].y+a[1].y*b[j].z;
if(onto>0)
onto=1;
else
onto=0;
for(int i=2;i<=n;i++){
int s;
if((b[j].x+a[i].x*b[j].y+a[i].y*b[j].z)>0)
s=1;
else
s=0;
if(a[i].t==temp&&s!=onto)
flag=0;
if(a[i].t!=temp&&s==onto)
flag=0;
}
if(flag==1)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
}
}
/*
9 3
1 1 A
1 0 A
1 -1 A
2 2 B
2 3 B
0 1 A
3 1 B
1 3 B
2 0 A
0 2 -3
-3 0 2
-3 1 1
*/