提交记录 8623


用户 题目 状态 得分 用时 内存 语言 代码长度
daniel14311531 noi17a. 【NOI2017】整数 Accepted 100 483.421 ms 117856 KB C++ 907 B
提交时间 评测时间
2019-02-27 14:29:14 2020-08-01 01:22:28
#include<bits/stdc++.h>
using namespace std;
const int N=32000010,M=1<<25;
int n,pp[50],lp;
bool w[2][N],t[M+M];

void add(int a,int b) {
	int x=(a<0? -a:a),l,r; if(!a) return ; lp=0;
	for(int i=30;~i;i--) if(x&(1<<i)) pp[++lp]=i;
	l=pp[lp]+b,r=pp[1]+b;
	for(int i=1,p;i<=lp;i++) {
		for(p=pp[i]+b;w[a>0][p];w[a>0][p]=0,++p);
		w[a>0][p]=1; if(p>r) r=p;
	}
	l+=M,r+=M;
	for(int i=l;i<=r;i++) t[i]=w[0][i-M]^w[1][i-M];
	for(l>>=1,r>>=1;l;l>>=1,r>>=1)
		for(int i=l;i<=r;i++) t[i]=t[i<<1]|t[i<<1|1];
}
int main() {
	scanf("%d%*d%*d%*d",&n);
	for(int opt,a,b;n;--n) {
		scanf("%d%d",&opt,&a);
		if(opt==1) scanf("%d",&b),add(a,b);
		else {
			int pos=-1;
			for(int k=a+M;k;k>>=1) {
				if(!(k&1)||!t[k^1]) continue;
				for(k^=1;k<M;k=k<<1|t[k<<1|1]);
				pos=k-M; break;
			}
			if(pos==-1||w[1][pos]>w[0][pos])
				printf("%d\n",w[1][a]^w[0][a]);
			else printf("%d\n",w[1][a]==w[0][a]);
		}
	}
	return 0;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #144.02 us100 KBAcceptedScore: 4

Testcase #283.24 us104 KBAcceptedScore: 4

Testcase #3762.77 us104 KBAcceptedScore: 4

Testcase #4934.4 us108 KBAcceptedScore: 4

Testcase #52.117 ms120 KBAcceptedScore: 4

Testcase #61.576 ms136 KBAcceptedScore: 4

Testcase #73.299 ms1 MB + 132 KBAcceptedScore: 4

Testcase #83.54 ms140 KBAcceptedScore: 4

Testcase #911.059 ms3 MB + 560 KBAcceptedScore: 4

Testcase #1017.712 ms1 MB + 264 KBAcceptedScore: 4

Testcase #1120.751 ms364 KBAcceptedScore: 4

Testcase #1215.12 ms7 MB + 580 KBAcceptedScore: 4

Testcase #1326.614 ms8 MB + 144 KBAcceptedScore: 4

Testcase #1485.88 ms23 MB + 100 KBAcceptedScore: 4

Testcase #1581.098 ms34 MB + 600 KBAcceptedScore: 4

Testcase #16177.139 ms46 MB + 100 KBAcceptedScore: 4

Testcase #17176.758 ms2 MB + 296 KBAcceptedScore: 4

Testcase #18275.482 ms69 MB + 84 KBAcceptedScore: 4

Testcase #19323.978 ms80 MB + 608 KBAcceptedScore: 4

Testcase #20397.093 ms69 MB + 528 KBAcceptedScore: 4

Testcase #21279.787 ms103 MB + 628 KBAcceptedScore: 4

Testcase #22330.136 ms4 MB + 184 KBAcceptedScore: 4

Testcase #23371.39 ms21 MB + 244 KBAcceptedScore: 4

Testcase #24352.281 ms4 MB + 460 KBAcceptedScore: 4

Testcase #25483.421 ms115 MB + 96 KBAcceptedScore: 4


Judge Duck Online | 评测鸭在线
Server Time: 2024-11-22 12:16:07 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠