QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#57659#4389. Copyqinjianbin#AC ✓114ms5480kbC++17915b2022-10-22 16:36:532022-10-22 16:36:55

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-22 16:36:55]
  • 评测
  • 测评结果:AC
  • 用时:114ms
  • 内存:5480kb
  • [2022-10-22 16:36:53]
  • 提交

answer

#include <bits/stdc++.h>
#include <ext/rope>
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define _for(i, a, b) for(int i = (a); i <= (b); i++)
using namespace std;
using namespace __gnu_cxx;

int n, q;

int main()
{
	int T; scanf("%d", &T);
	while(T--)
	{
		scanf("%d%d", &n, &q);
		rope<int> a;
		a.push_back(0);

		_for(i, 1, n)
		{
			int x; scanf("%d", &x);
			a.push_back(x);
		}

		int ans = 0;
		while(q--)
		{
			//for(int x: a) printf("%d ", x); puts("");

			int op; scanf("%d", &op);
			if(op == 1)
			{
				int l, r;
				scanf("%d%d", &l, &r);
				a = a.substr(a.begin(), a.begin() + r + 1) +
					a.substr(a.begin() + l, a.begin() + r + 1) + 
					a.substr(a.begin() + r + 1, a.end());
				a = a.substr(a.begin(), a.begin() + n + 1);
			}
			else
			{
				int x; scanf("%d", &x);
				ans ^= a[x];
			}
		}
		printf("%d\n", ans);
	}

	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 114ms
memory: 5480kb

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