提交记录 29167


用户 题目 状态 得分 用时 内存 语言 代码长度
Dr_mark noi17a. 【NOI2017】整数 Accepted 100 458.382 ms 85724 KB C++ 1.88 KB
提交时间 评测时间
2026-07-19 09:07:16 2026-07-19 09:07:28
#include<bits/stdc++.h>
#define N 30000005
using namespace std;
const int L=200005;
char LZH[L],*S=LZH,*T=LZH;
inline char gc(){
    if (S==T){
        T=(S=LZH)+fread(LZH,1,L,stdin);
        if (S==T) return EOF;
    }
    return *S++;
}
inline int read(){
    int x=0,f=1;
    char c=gc();
    for (;c<'0'||c>'9';c=gc())
        if (c=='-') f=-1;
    for (;c>='0'&&c<='9';c=gc())
        x=(x<<1)+(x<<3)+c-48;
    return x*f;
}
int n,x,y;
bool fl,a[N],b[N];
struct ZYY_CMP{
    bool operator ()(const int &x,const int &y){
        return x>y;
    }
};
struct ZYY_SET{
    int cnt[2000005];
    set<int,ZYY_CMP> S;
    ZYY_SET(){
        S.insert(-1);
        memset(cnt,0,sizeof(cnt));
    }
    void insert(int x){
        x+=16;
        if (!cnt[x>>4]) S.insert(x>>4);
        cnt[x>>4]++;
    }
    void erase(int x){
        x+=16;
        cnt[x>>4]--;
        if (!cnt[x>>4]) S.erase(x>>4);
    }
    int query(int x){
        if (x<0) return -2;
        x+=16;
        for (int i=x;i>=((x>>4)<<4)&&i>=16;i--)
            if (a[i-16]^b[i-16]) return i-16;
        int y=*S.lower_bound((x>>4)-1);
        if (y==-1) return -2;
        for (int i=(y<<4)+15;i>=(y<<4)&&i>=16;i--)
            if (a[i-16]^b[i-16]) return i-16;
        return -2;
    }
}Set;
inline void add(){
    bool tg=1;
    for (int i=y;i<=n*30&&((tg^1)||x);i++,x/=2){
        if ((tg^1)^(x&1)){
            if (a[i]^b[i]) Set.erase(i);
            else Set.insert(i);
            if (fl) tg=(a[i]^=1);
            else tg=(b[i]^=1);
        }
        else
            tg=((tg^1)&&(x&1))^1;
    }
}
int main(){
    n=read(); read(); read(); read();
    Set.insert(-2);
    for (int i=1;i<=n;i++){
        if (read()==1){
            x=read(); y=read();
            fl=(x>0); x=x<0?-x:x;
            add();
        }
        else{
            x=read(); y=Set.query(x-1);
            putchar((a[x]^b[x]^(y!=-2&&!a[y]))+'0'); puts("");
        }
    }
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #1671.74 us7 MB + 692 KBAcceptedScore: 4

Testcase #2687.74 us7 MB + 696 KBAcceptedScore: 4

Testcase #31.063 ms7 MB + 712 KBAcceptedScore: 4

Testcase #41.003 ms7 MB + 740 KBAcceptedScore: 4

Testcase #52.274 ms7 MB + 784 KBAcceptedScore: 4

Testcase #61.231 ms7 MB + 800 KBAcceptedScore: 4

Testcase #73.489 ms8 MB + 500 KBAcceptedScore: 4

Testcase #83.289 ms7 MB + 888 KBAcceptedScore: 4

Testcase #910.679 ms10 MB + 148 KBAcceptedScore: 4

Testcase #1015.812 ms8 MB + 804 KBAcceptedScore: 4

Testcase #1116.459 ms8 MB + 192 KBAcceptedScore: 4

Testcase #128.295 ms12 MB + 104 KBAcceptedScore: 4

Testcase #1324.726 ms13 MB + 164 KBAcceptedScore: 4

Testcase #1476.348 ms23 MB + 56 KBAcceptedScore: 4

Testcase #1545.722 ms27 MB + 456 KBAcceptedScore: 4

Testcase #16162.8 ms38 MB + 232 KBAcceptedScore: 4

Testcase #17143.172 ms10 MB + 544 KBAcceptedScore: 4

Testcase #18256.985 ms53 MB + 420 KBAcceptedScore: 4

Testcase #19306.122 ms60 MB + 1004 KBAcceptedScore: 4

Testcase #20408.456 ms47 MB + 584 KBAcceptedScore: 4

Testcase #21170.923 ms66 MB + 608 KBAcceptedScore: 4

Testcase #22269.342 ms12 MB + 844 KBAcceptedScore: 4

Testcase #23341.316 ms25 MB + 276 KBAcceptedScore: 4

Testcase #24285.517 ms13 MB + 156 KBAcceptedScore: 4

Testcase #25458.382 ms83 MB + 732 KBAcceptedScore: 4


Judge Duck Online | 评测鸭在线
Server Time: 2026-09-12 19:18:02 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠