栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

CSP 202006-1 线性分类器

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

CSP 202006-1 线性分类器

2022.2.14 练习 CSP 202006-1 线性分类器

#include 
using 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.type0)
        N[0].tt=1;
    for(int i=1;i0)
        {
            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"<
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/738235.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号