提交记录 3273


用户 题目 状态 得分 用时 内存 语言 代码长度
Mogician noi17a. 【NOI2017】整数 Accepted 100 460.467 ms 16320 KB C++ 1.21 KB
提交时间 评测时间
2018-07-11 09:16:45 2020-07-31 21:14:56
#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.2 us44 KBAcceptedScore: 4

Testcase #264.8 us44 KBAcceptedScore: 4

Testcase #3411.29 us64 KBAcceptedScore: 4

Testcase #41.115 ms80 KBAcceptedScore: 4

Testcase #5837.68 us132 KBAcceptedScore: 4

Testcase #61.266 ms124 KBAcceptedScore: 4

Testcase #71.679 ms300 KBAcceptedScore: 4

Testcase #81.834 ms192 KBAcceptedScore: 4

Testcase #95.932 ms912 KBAcceptedScore: 4

Testcase #107.839 ms772 KBAcceptedScore: 4

Testcase #1111.976 ms644 KBAcceptedScore: 4

Testcase #1211.005 ms1 MB + 236 KBAcceptedScore: 4

Testcase #1314.767 ms1 MB + 440 KBAcceptedScore: 4

Testcase #1446.564 ms3 MB + 108 KBAcceptedScore: 4

Testcase #1559.138 ms3 MB + 772 KBAcceptedScore: 4

Testcase #16100.088 ms5 MB + 672 KBAcceptedScore: 4

Testcase #17116.176 ms1 MB + 280 KBAcceptedScore: 4

Testcase #18156.414 ms8 MB + 240 KBAcceptedScore: 4

Testcase #19189.27 ms9 MB + 508 KBAcceptedScore: 4

Testcase #20460.467 ms15 MB + 960 KBAcceptedScore: 4

Testcase #21206.814 ms10 MB + 196 KBAcceptedScore: 4

Testcase #22234.88 ms1 MB + 928 KBAcceptedScore: 4

Testcase #23182.049 ms4 MB + 468 KBAcceptedScore: 4

Testcase #24250.422 ms1 MB + 1020 KBAcceptedScore: 4

Testcase #25292.827 ms13 MB + 324 KBAcceptedScore: 4


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