样例(文本):
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
#include<iostream>
using namespace std;
struct point{
int x;
int y;
char type;
int record;
};
int main(){
int n,m;
cin>>n>>m;
point p[n];
for(int i=0;i<n;i++){
cin>>p[i].x>>p[i].y>>p[i].type;
}
int o,o1,o2,rec;
for(int i=0;i<m;i++){
cin>>o>>o1>>o2;
rec=0;
for(int j=0;j<n;j++){
if(o+o1*p[j].x+o2*p[j].y>0)
p[j].record=1;
else
p[j].record=-1;
if(j!=0){
if(p[j].type!=p[j-1].type&&p[j].record==p[j-1].record){
rec=1;
cout<<"No"<<endl;
break;
}
else if(p[j].type==p[j-1].type&&p[j].record!=p[j-1].record){
rec=1;
cout<<"No"<<endl;
break;
}
}
}
if(rec==0)
cout<<"Yes"<<endl;
}
}