2022.2.14 练习 CSP 202006-1 线性分类器
#includeusing namespace std; const int MAX_NUM=1e7; int n,m; struct Node { int x,y; int type; int tt; }N[MAX_NUM]; bool cmp(Node a,Node b) { return a.type 0) N[0].tt=1; for(int i=1;i 0) { N[i].tt=1; } if(N[i].type==N[i-1].type ) { if( N[i].tt==N[i-1].tt) continue; else { flag=0; break; } } } if(flag==0) return -1; else if(flag==1) return 1; } int main() { std::ios::sync_with_stdio(false); cin>>n>>m; for(int i=0;i >x>>y>>str; N[i].x=x; N[i].y=y; if(str=="A") N[i].type=1; else if(str=="B") N[i].type=2; } sort(N,N+n,cmp); while(m--) { int c1,c2,c3; cin>>c1>>c2>>c3; int res=judge(c1,c2,c3); if(res==1) cout<<"Yes"<



