提交记录 3426


用户 题目 状态 得分 用时 内存 语言 代码长度
admin noi17a. 【NOI2017】整数 Accepted 100 1.817 s 108268 KB C++ 1.43 KB
提交时间 评测时间
2018-07-15 00:52:51 2020-07-31 21:17:24
#include<bits/stdc++.h>
using namespace std;
typedef long long L;
char *TT,*tmo,but[(1<<15)+2];
#define gc ((TT==tmo&&(tmo=((TT=but)+fread(but,1,1<<15,stdin)),TT==tmo))?-1:*TT++)
inline int rd(){
	int x,f=1,c;for(;!isdigit(c=gc);)f=c!='-';x=c-'0';
	for(;isdigit(c=gc);)x=x*10+c-'0';return f?x:-x;
}
#ifdef flukehn
#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
#define debug(...)
#endif
int n;
void add(set<int>&a,set<int>&b,int k){
	for(;a.count(k);){
		a.erase(k);
		++k;
	}
	if(b.count(k))b.erase(k);
	else a.insert(k);
}
set<int> a,b;
int qr(int k){
	set<int>::iterator it,jt;
	it=b.upper_bound(k);
	if(it==b.begin())return a.count(k);
	--it;
	jt=a.upper_bound(*it);
	if(jt==a.end())return 0;
	if(*it==k){
		return it==b.begin() || a.upper_bound(*(--it)) != jt;
	}
	return *jt>k || (*jt<k && a.count(k));
	/*
	if(jt!=a.end())debug("%d %d\n",*it,*jt);
	return jt!=a.end() && (*jt>k || (*jt<k && a.count(k)));*/
}
int main(){
#ifdef flukehn
	freopen("g.in","r",stdin);
#endif
	n=rd(),rd(),rd(),rd();
	int op,x,y,k;
	for(;n--;){
		op=rd();
		if(op==2){
			k=rd();
			putchar(qr(k)+'0');
			putchar('\n');
		}else{
			x=rd(),y=rd();
			if(x>0){
				for(int i=0;i<30;++i)
					if(x>>i&1) add(a,b,y+i);
			}else{
				x=-x;
				for(int i=0;i<30;++i)
					if(x>>i&1) add(b,a,y+i);
			}
			/*int th=0;
			for(int i:a)
				th+=1<<i,debug("%d ",i);
				debug("\n");
			for(int i:b)
				th-=1<<i,debug("%d ",i);
				debug("\n");
			debug("x=%d\n",th);*/
		}
	}
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #146.39 us44 KBAcceptedScore: 4

Testcase #2180.76 us44 KBAcceptedScore: 4

Testcase #32.595 ms64 KBAcceptedScore: 4

Testcase #4725.58 us140 KBAcceptedScore: 4

Testcase #54.856 ms92 KBAcceptedScore: 4

Testcase #6882.57 us128 KBAcceptedScore: 4

Testcase #79.461 ms1 MB + 8 KBAcceptedScore: 4

Testcase #810.44 ms300 KBAcceptedScore: 4

Testcase #934.253 ms3 MB + 264 KBAcceptedScore: 4

Testcase #1050.568 ms2 MB + 524 KBAcceptedScore: 4

Testcase #1172.072 ms1 MB + 460 KBAcceptedScore: 4

Testcase #128.382 ms636 KBAcceptedScore: 4

Testcase #1387.648 ms7 MB + 412 KBAcceptedScore: 4

Testcase #14280.593 ms21 MB + 300 KBAcceptedScore: 4

Testcase #1548.83 ms2 MB + 648 KBAcceptedScore: 4

Testcase #16614.967 ms42 MB + 560 KBAcceptedScore: 4

Testcase #17756.747 ms11 MB + 608 KBAcceptedScore: 4

Testcase #18963.026 ms63 MB + 660 KBAcceptedScore: 4

Testcase #191.271 s74 MB + 136 KBAcceptedScore: 4

Testcase #20367.061 ms18 MB + 1000 KBAcceptedScore: 4

Testcase #21174.021 ms7 MB + 764 KBAcceptedScore: 4

Testcase #221.623 s21 MB + 448 KBAcceptedScore: 4

Testcase #231.454 s46 MB + 920 KBAcceptedScore: 4

Testcase #241.694 s22 MB + 840 KBAcceptedScore: 4

Testcase #251.817 s105 MB + 748 KBAcceptedScore: 4


Judge Duck Online | 评测鸭在线
Server Time: 2024-11-25 14:04:42 | Loaded in 3 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠