提交记录 3457


用户 题目 状态 得分 用时 内存 语言 代码长度
zhouyuyang noi17a. 【NOI2017】整数 Accepted 100 443.424 ms 36060 KB C++ 1.45 KB
提交时间 评测时间
2018-07-15 18:36:35 2020-07-31 21:17:45
#include<bits/stdc++.h>
#define N 30000005
using namespace std;
const int L=2333333;
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(){
	char ch=gc();
	int x=0,f=1;
	for (;ch<'0'||ch>'9';ch=gc())
		if (ch=='-') f=-1;
	for (;ch>='0'&&ch<='9';ch=gc())
		x=x*10-48+ch;
	return x*f;
}
int n,x,y;
bool fl;
bitset<N> a,b;
struct CMP{
	bool operator ()(const int &x,const int &y){
		return x>y;
	}
};
struct SET{
	int cnt[(N>>4)+1];
	set<int,CMP> s;
	SET(){
		s.insert(-1);
		memset(cnt,0,sizeof(cnt));
	}
	void insert(int x){
		x+=16; x>>=4;
		if (!(cnt[x]++)) s.insert(x);
	}
	void erase(int x){
		x+=16; x>>=4;
		if (!(--cnt[x])) s.erase(x);
	}
	int query(int x){
		if (x<0) return -2;
		for (int i=x;i>=((x>>4)<<4)&&i>=0;i--)
			if (a[i]^b[i]) return i;
		int y=*s.lower_bound(x>>4);
		if (y==-1) return -2; y=(y-1)<<4;
		for (int i=y+15;i>=y&&i>=0;i--)
			if (a[i]^b[i]) return i;
		return -2;	
	}
}Set;
void add(){
	register bool tg=0;
	for (register int i=y;tg||x;i++,x>>=1)
		if (tg^(x&1)){
			a[i]^b[i]?Set.erase(i):Set.insert(i);
			tg=(fl?a[i]:b[i]);
			fl?a[i]=1-a[i]:b[i]=1-b[i];
		}
		else
			tg&=(x&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 #1631.14 us7 MB + 204 KBAcceptedScore: 4

Testcase #2659.97 us7 MB + 204 KBAcceptedScore: 4

Testcase #31.043 ms7 MB + 224 KBAcceptedScore: 4

Testcase #4970.09 us7 MB + 252 KBAcceptedScore: 4

Testcase #52.279 ms7 MB + 296 KBAcceptedScore: 4

Testcase #61.219 ms7 MB + 296 KBAcceptedScore: 4

Testcase #73.432 ms7 MB + 576 KBAcceptedScore: 4

Testcase #83.352 ms7 MB + 380 KBAcceptedScore: 4

Testcase #910.535 ms8 MB + 448 KBAcceptedScore: 4

Testcase #1015.749 ms8 MB + 500 KBAcceptedScore: 4

Testcase #1117.078 ms8 MB + 264 KBAcceptedScore: 4

Testcase #127.713 ms8 MB + 876 KBAcceptedScore: 4

Testcase #1324.569 ms10 MB + 92 KBAcceptedScore: 4

Testcase #1472.417 ms14 MB + 616 KBAcceptedScore: 4

Testcase #1538.763 ms13 MB + 1012 KBAcceptedScore: 4

Testcase #16154.695 ms19 MB + 788 KBAcceptedScore: 4

Testcase #17144.502 ms11 MB + 264 KBAcceptedScore: 4

Testcase #18246.63 ms24 MB + 952 KBAcceptedScore: 4

Testcase #19293.009 ms27 MB + 516 KBAcceptedScore: 4

Testcase #20385.623 ms29 MB + 104 KBAcceptedScore: 4

Testcase #21151.463 ms23 MB + 96 KBAcceptedScore: 4

Testcase #22274.002 ms12 MB + 852 KBAcceptedScore: 4

Testcase #23328.06 ms18 MB + 432 KBAcceptedScore: 4

Testcase #24292.986 ms13 MB + 60 KBAcceptedScore: 4

Testcase #25443.424 ms35 MB + 220 KBAcceptedScore: 4


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