#include<iostream>
#include<bits/stdc++.h>
using namespace std;
struct Point{
int x;
int y;
}pointA[1005],pointB[1005];
int main(){
std::ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n,m;
cin>>n>>m;
int xcount=1;
int ycount=1;
for(int i=1;i<=n;i++){
string type;
int xtemp,ytemp;
cin>>xtemp>>ytemp>>type;
if(type == "A"){
pointA[xcount].x=xtemp;
pointA[xcount].y=ytemp;
xcount++;
}else if(type == "B"){
pointB[ycount].x=xtemp;
pointB[ycount].y=ytemp;
ycount++;
}
}
int flag[m]={0};
for(int j=1;j<=m;j++){
int t0,t1,t2;
cin>>t0>>t1>>t2;
int resultA =t0+t1*pointA[1].x+t2*pointA[1].y;
int resultB =t0+t1*pointB[1].x+t2*pointB[1].y;
for(int i=2;i<xcount;i++){
int resA =t0+t1*pointA[i].x+t2*pointA[i].y;
if(resA>0&&resultA<0||resA<0&&resultA>0){
flag[j]=1;
break;
}
}
for(int i=2;i<ycount;i++){
int resB =t0+t1*pointB[i].x+t2*pointB[i].y;
if(resB<0&&resultB>0||resB>0&&resultB<0){
flag[j]=1;
break;
}
}
}
for(int i=1;i<=m;i++){
if(flag[i]==1){
cout<<"No"<<endl;
}
else
cout<<"Yes"<<endl;
}
}
写在最后:
该博客是本人学习的一些总结,如果各位有不同见解,可以评论提出或者与我联系改正,谢谢阅览!!