提交记录 4631


用户 题目 状态 得分 用时 内存 语言 代码长度
saffah noi17a. 【NOI2017】整数 Accepted 100 460.27 ms 16320 KB C++ 1.21 KB
提交时间 评测时间
2018-07-26 19:32:46 2020-07-31 23:09:16
// #3273
#include<stdio.h>
#include<iostream>
#include<set>
using namespace std;
namespace INPUT{
	const int L=1<<19;
	char _buf[L],*S,*T,c;int op;
	char _gc(){
		if(S==T){
			T=(S=_buf)+fread(_buf,1,L,stdin);
			if(S==T) return EOF;
		}return *S++;
	}
	void Readi(int &x){
		for(c=_gc();(c<'0'||c>'9')&&c!='-';c=_gc());
		op=1;if(c=='-')op=-1,c=_gc();
		for(x=0;c>='0'&&c<='9';c=_gc())x=x*10+(c&15);x*=op;
	}
}
using INPUT::Readi;
set<int>pos,neg;
typedef long long LL;
const LL C=1ll<<60;
const int N=1000010;
LL val[N];int n;
void update(int x,const LL v){
	if(val[x]<0)neg.erase(x);
	if(val[x]>0)pos.erase(x);
	val[x]+=v;
	if(val[x]>=C)val[x]-=C,update(x+1,1);
	if(val[x]<=-C)val[x]+=C,update(x+1,-1);
	if(val[x]<0)neg.insert(x);
	if(val[x]>0)pos.insert(x); 
}
int main(){
	neg.insert(-1);pos.insert(-1);
	Readi(n);int op,x,y;
	Readi(op);Readi(op);Readi(op);
	for(int i=1;i<=n;i++){
		Readi(op);Readi(x);
		if(op==1){
			Readi(y);
			LL tmp=x;int s=1;
			if(tmp<0)tmp=-tmp,s=-s;
			update(y/60,s*((tmp&(1LL<<60-y%60)-1)<<y%60));
			update(y/60+1,s*(tmp>>60-y%60));
		}
		else{
			int t=x/60;LL Res=val[t];
			if(*(--pos.lower_bound(t))<*(--neg.lower_bound(t)))Res--;
			if(Res<0)Res+=C;
			printf("%d\n",(Res>>x%60)&1);
		}
	}
	return 0;
} 

CompilationN/AN/ACompile OKScore: N/A

Testcase #139.61 us44 KBAcceptedScore: 4

Testcase #274.46 us44 KBAcceptedScore: 4

Testcase #3411.94 us64 KBAcceptedScore: 4

Testcase #41.117 ms80 KBAcceptedScore: 4

Testcase #5836.39 us132 KBAcceptedScore: 4

Testcase #61.257 ms124 KBAcceptedScore: 4

Testcase #71.678 ms300 KBAcceptedScore: 4

Testcase #81.854 ms192 KBAcceptedScore: 4

Testcase #95.939 ms912 KBAcceptedScore: 4

Testcase #107.838 ms772 KBAcceptedScore: 4

Testcase #1111.874 ms644 KBAcceptedScore: 4

Testcase #1211.005 ms1 MB + 236 KBAcceptedScore: 4

Testcase #1314.801 ms1 MB + 440 KBAcceptedScore: 4

Testcase #1446.649 ms3 MB + 108 KBAcceptedScore: 4

Testcase #1559.132 ms3 MB + 772 KBAcceptedScore: 4

Testcase #16100.2 ms5 MB + 672 KBAcceptedScore: 4

Testcase #17116.463 ms1 MB + 280 KBAcceptedScore: 4

Testcase #18156.982 ms8 MB + 240 KBAcceptedScore: 4

Testcase #19188.44 ms9 MB + 508 KBAcceptedScore: 4

Testcase #20460.27 ms15 MB + 960 KBAcceptedScore: 4

Testcase #21207.443 ms10 MB + 196 KBAcceptedScore: 4

Testcase #22234.36 ms1 MB + 928 KBAcceptedScore: 4

Testcase #23182.493 ms4 MB + 468 KBAcceptedScore: 4

Testcase #24250.431 ms1 MB + 1020 KBAcceptedScore: 4

Testcase #25293.32 ms13 MB + 324 KBAcceptedScore: 4


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