ccf真题 202006-1 线性分类器
作者:互联网
样例(文本):
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;
}
}
标签:202006,int,cin,分类器,record,rec,ccf,type,o2 来源: https://blog.csdn.net/wen_wan_sheng/article/details/120312184