提交记录 16510


用户 题目 状态 得分 用时 内存 语言 代码长度
gyh20 noi17a. 【NOI2017】整数 Accepted 100 307.759 ms 17864 KB C++ 1.34 KB
提交时间 评测时间
2021-09-22 21:04:15 2021-09-22 21:04:22
#include<bits/stdc++.h>
#define re register
#define ui unsigned long long
using namespace std;
const int Mxdt=1000000;
inline char gc(){
	static char buf[Mxdt],*p1=buf,*p2=buf;
	return p1==p2&&(p2=(p1=buf)+fread(buf,1,Mxdt,stdin),p1==p2)?EOF:*p1++;
}
inline char pc(char ch,bool bj){
	static char buf[Mxdt],*p1=buf,*p2=buf+Mxdt;
	return (bj||(*p1++=ch)&&p1==p2)&&fwrite(p1=buf,1,p1-buf,stdout),0;
}
inline int read(){
	re int t=0,f=0;re char v=gc();
	while(v<'0')f|=(v=='-'),v=gc();
	while(v>='0')t=(t<<3)+(t<<1)+v-48,v=gc();
	return f?-t:t;
}
ui A[2][1100002];
int Z,n,m;
set<int>S;
set<int>::iterator it;
inline void add(re int x,re ui y){
	if(A[Z][x]+y<A[Z][x])add(x+1,1);
	A[Z][x]+=y;
	if(A[Z][x]^A[Z^1][x])S.insert(x);
	else if(S.find(x)!=S.end())S.erase(x);
}
int main(){
	n=read(),read(),read(),read();
	while(n--){
		re int o=read(),X=read();
		if(o==1){
			if(X>0)Z=0;
			else X=-X,Z=1;
			re ui x=X,y=read();
			re int p1=y>>6,p2=y&63;
			add(p1,x<<p2);if(p2)add(p1+1,x>>(64-p2));
		}
		else{
			re int ans,p1=X>>6,p2=X&63,ia=0;
			re ui v1=A[0][p1],v2=A[1][p1];
			ans=(v1>>p2&1)^(v2>>p2&1);
			if(p2){
				v1&=(1ull<<p2)-1,v2&=(1ull<<p2)-1;
				if(v1>v2)ia=1;
				else if(v1<v2)ia=1,ans^=1;
			}
			if(!ia){
				it=S.lower_bound(p1);
				if(it!=S.begin()){
					--it;
					if(A[0][*it]<A[1][*it])ans^=1;
				}
			}
			pc(ans+'0',0),pc('\n',0);
		}
	}
	pc('o',1);
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #137.15 us48 KBAcceptedScore: 4

Testcase #245.7 us52 KBAcceptedScore: 4

Testcase #399.89 us72 KBAcceptedScore: 4

Testcase #4219.22 us84 KBAcceptedScore: 4

Testcase #5322.03 us132 KBAcceptedScore: 4

Testcase #6377.87 us136 KBAcceptedScore: 4

Testcase #7858.49 us340 KBAcceptedScore: 4

Testcase #8614.89 us208 KBAcceptedScore: 4

Testcase #92.931 ms1 MB + 4 KBAcceptedScore: 4

Testcase #104.004 ms1 MB + 116 KBAcceptedScore: 4

Testcase #114.096 ms1 MB + 16 KBAcceptedScore: 4

Testcase #125.511 ms1 MB + 676 KBAcceptedScore: 4

Testcase #137.832 ms2 MB + 148 KBAcceptedScore: 4

Testcase #1424.27 ms4 MB + 300 KBAcceptedScore: 4

Testcase #1530.536 ms5 MB + 372 KBAcceptedScore: 4

Testcase #1653.279 ms7 MB + 592 KBAcceptedScore: 4

Testcase #1741.248 ms2 MB + 60 KBAcceptedScore: 4

Testcase #1888.997 ms10 MB + 896 KBAcceptedScore: 4

Testcase #19111.666 ms12 MB + 536 KBAcceptedScore: 4

Testcase #20307.759 ms16 MB + 648 KBAcceptedScore: 4

Testcase #21121.115 ms14 MB + 96 KBAcceptedScore: 4

Testcase #2282.071 ms2 MB + 992 KBAcceptedScore: 4

Testcase #23102.683 ms5 MB + 732 KBAcceptedScore: 4

Testcase #2492.157 ms3 MB + 104 KBAcceptedScore: 4

Testcase #25173.124 ms17 MB + 456 KBAcceptedScore: 4


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