提交记录 3333


用户 题目 状态 得分 用时 内存 语言 代码长度
Decyx_asmend noi17a. 【NOI2017】整数 Accepted 100 65.39 ms 30908 KB C++11 2.12 KB
提交时间 评测时间
2018-07-13 15:18:04 2020-07-31 21:15:34
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
char ibuf[1<<25],*ih=ibuf,obuf[1<<21],*oh=obuf;
inline void read(int&x){
	int f=1;
	for(x=0;!isdigit(*ih);++ih)if(*ih=='-')f=-1;
	for(;isdigit(*ih);x=x*10+*ih++-48);x*=f;
}
const int N=1100005;
const ull all=(1ll<<60)-1;
int n,t1,t2,t3;
ull p[N/2],q[N/2],bi[70];
struct tree{
	unsigned short ch[6][N/4];
	int low[65539],high[65539],l,hib[65539],pr[65539][16];
	inline void ini(int n){
		for(l=0;1<<(l*4)<=n;++l);--l;
		int i,j;
		for(i=0;i<65536;++i){
			for(j=0;i>>j&1;++j);low[i]=j;
			for(j=15;j>=0 && i>>j&1;--j);high[i]=j;
			int lst=0;
			for(j=0;j<16;++j){
				pr[i][j]=lst;
				if(!(i>>j&1))lst=j;
			}
		}
		for(i=0;i<=l;++i)
			memset(ch[i],-1,2<<(i*4));
	}
	inline void ins(int i){
		ch[l][i>>4]|=1<<(i&15);i>>=4;
		for(int j=l;j && ch[j][i]==65535;--j,i>>=4)
			ch[j-1][i>>4]|=1<<(i&15);
	}
	inline void del(int i){
		for(int j=l;j>=0 && ch[j][i>>4]>>(i&15)&1;--j,i>>=4)
			ch[j][i>>4]^=1<<(i&15);
	}
	inline int ask(int i){
		if(i<0)return 0;
		int j=l;
		for(;j>=0;--j,i>>=4){
			if(low[ch[j][i>>4]]<(i&15)){
				int x=(i>>4<<4)|pr[ch[j][i>>4]][i&15];++j;
				for(;j<=l;x=x<<4|high[ch[j][x]],++j);
				return x+1;
			}
		}
		return 0;
	}
}T;
inline void add(ull x,int y){
	for(;x;++y){
		if(p[y]==q[y])T.del(y);
		p[y]+=x;x=p[y]>>60;p[y]&=all;
		if(p[y]==q[y])T.ins(y);
	}
}
inline void mns(ull x,int y){
	for(;x;++y){
		if(p[y]==q[y])T.del(y);
		q[y]+=x;x=q[y]>>60;q[y]&=all;
		if(p[y]==q[y])T.ins(y);
	}
}
int main(){
	//freopen("integer5.in","r",stdin);
	fread(ibuf,1,1<<25,stdin);
	read(n);read(t1);read(t2);read(t3);
	T.ini(n+25);
	for(int i=0;i<=60;++i)bi[i]=(1ll<<i)-1;
	int cnt=0;
	while(n--){
		int o,a,b;
		read(o);read(a);
		if(o==1){
			read(b);
			int x=60-b%60,y=b/60;
			if(a<0){
				a=-a,mns(((ull)a&bi[x])<<(b%60),y);
				mns((ull)a>>x,y+1);
			}else add(((ull)a&bi[x])<<(b%60),y),add((ull)a>>x,y+1);
		}else{
			int x=a%60,y=a/60,z=(p[y]>>x&1)-(q[y]>>x&1);
			if((p[y]&bi[x])==(q[y]&bi[x])){
				int u=T.ask(y);
				if(u && p[u-1]<q[u-1])--z;
			}else z-=(p[y]&bi[x])<(q[y]&bi[x]);
			*oh++='0'+(z+4)%2;*oh++='\n';
		}
	}
	return fwrite(obuf,1,oh-obuf,stdout),0;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #11.155 ms4 MB + 580 KBAcceptedScore: 4

Testcase #21.164 ms4 MB + 580 KBAcceptedScore: 4

Testcase #31.207 ms4 MB + 612 KBAcceptedScore: 4

Testcase #41.235 ms4 MB + 624 KBAcceptedScore: 4

Testcase #51.334 ms4 MB + 688 KBAcceptedScore: 4

Testcase #61.337 ms4 MB + 676 KBAcceptedScore: 4

Testcase #71.514 ms4 MB + 812 KBAcceptedScore: 4

Testcase #81.458 ms4 MB + 752 KBAcceptedScore: 4

Testcase #92.394 ms5 MB + 316 KBAcceptedScore: 4

Testcase #103.111 ms5 MB + 528 KBAcceptedScore: 4

Testcase #113.093 ms5 MB + 520 KBAcceptedScore: 4

Testcase #123.378 ms5 MB + 840 KBAcceptedScore: 4

Testcase #134.27 ms6 MB + 432 KBAcceptedScore: 4

Testcase #1410.717 ms9 MB + 656 KBAcceptedScore: 4

Testcase #1512.737 ms10 MB + 664 KBAcceptedScore: 4

Testcase #1621.181 ms14 MB + 828 KBAcceptedScore: 4

Testcase #1718.934 ms12 MB + 860 KBAcceptedScore: 4

Testcase #1833.595 ms19 MB + 960 KBAcceptedScore: 4

Testcase #1940.972 ms22 MB + 512 KBAcceptedScore: 4

Testcase #2054.757 ms18 MB + 96 KBAcceptedScore: 4

Testcase #2146.912 ms22 MB + 828 KBAcceptedScore: 4

Testcase #2234.443 ms20 MB + 344 KBAcceptedScore: 4

Testcase #2349.478 ms23 MB + 360 KBAcceptedScore: 4

Testcase #2436.628 ms21 MB + 348 KBAcceptedScore: 4

Testcase #2565.39 ms30 MB + 188 KBAcceptedScore: 4


Judge Duck Online | 评测鸭在线
Server Time: 2024-03-29 23:43:28 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用