我是靠谱客的博主 魁梧火,这篇文章主要介绍1539:简单题,现在分享给大家,希望可以做个参考。

 

const int N=2e5+5;
 
    int n,m,t;
    int i,j,k;
    int L[N];
    int R[N];

void update(int pos,int val,int *c)
{
    for(int i=pos;i<=N;i+=lowbit(i)){
        c[i]+=val;
    }
}
int sum(int pos,int *c)
{
    int ans=0;
    for(int i=pos;i;i-=lowbit(i)){
        ans+=c[i];
    }
    return ans;
}

int main()
{
    //IOS;
    while(~sdd(n,k)){
        for(i=1;i<=k;i++){
            int tag,x,y;
            sd(tag);
            if(tag==1){
                sdd(x,y);
                update(x,1,L);
                update(y,1,R);
            }
            else if(tag==2){
                sd(x);
                int ans=sum(x,L)-sum(x-1,R);
                if(ans&1) pd(1);
                else pd(0);
            }
        }
    }
    //PAUSE;
    return 0;
}

 

最后

以上就是魁梧火最近收集整理的关于1539:简单题的全部内容,更多相关1539内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(110)

评论列表共有 0 条评论

立即
投稿
返回
顶部