QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#397164#4389. CopyDiuAC ✓483ms4468kbC++14832b2024-04-23 18:47:112024-04-23 18:47:11

Judging History

你现在查看的是最新测评结果

  • [2024-04-23 18:47:11]
  • 评测
  • 测评结果:AC
  • 用时:483ms
  • 内存:4468kb
  • [2024-04-23 18:47:11]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
using namespace std;

const int N=1e5+10;
inline int read(){
	int x = 0, f = 1; char c = getchar();
	while(c < '0' || c > '9'){if(c == '-')f = -1; c = getchar();}
	while(c >= '0' && c <= '9'){x = (x << 1) + (x << 3) + c - '0'; c = getchar();}
	return x * f;
}
int T,n,q;
int a[N],l[N],r[N],tot;
int main(){
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);
	scanf("%d",&T);
	for(;T--;){
		scanf("%d%d",&n,&q);
		for(int i=1;i<=n;i++)scanf("%d",&a[i]);
		tot=0;
		int ans=0;
		for(int op,x;q--;){
			scanf("%d",&op);
			if(op==1){
				++tot;
				scanf("%d%d",&l[tot],&r[tot]);
			}else{
				scanf("%d",&x);
				for(int i=tot;i>=1;i--){
					if(x>r[i])x-=(r[i]-l[i]+1);
				}
				ans^=a[x];
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 483ms
memory: 4468kb

input:

2
5 10
14138491 23289232 33892225 43531245 54436322
1 1 4
2 2
2 3
2 4
2 5
1 2 4
2 2
2 3
2 4
2 5
99990 99990
493133979 94198606 751145654 147404311 601524088 744747426 561746143 212260573 241231749 810352224 81276441 382492450 18779020 317505899 880615584 654793240 417574821 822313301 140569958 69317...

output:

28631531
787379207

result:

ok 2 lines