QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#48719#4389. Copyneko_nyaa#AC ✓188ms3964kbC++141.2kb2022-09-15 13:26:442022-09-15 13:26:46

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-09-15 13:26:46]
  • 评测
  • 测评结果:AC
  • 用时:188ms
  • 内存:3964kb
  • [2022-09-15 13:26:44]
  • 提交

answer

#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")

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

inline char gc() {
	static char buf[1 << 16];
	static size_t bc, be;
	if (bc >= be) {
		buf[0] = 0, bc = 0;
		be = fread(buf, 1, sizeof(buf), stdin);
	}
	return buf[bc++];
}
 
int readInt() {
	int a, c;
	while ((a = gc()) < 40);
	if (a == '-') return -readInt();
	while ((c = gc()) >= 48) a = a * 10 + c - 480;
	return a - 48;
}

void solve() {
	int n = readInt(), q = readInt();
	int a[n];
	for (int i = 0; i < n; i++) {
		a[i] = readInt();
	}

	int res = 0;
	while (q--) {
		int t = readInt(); 

		if (t == 1) {
			int l = readInt(), r = readInt(); l--;
			int len = r-l;
			int i = n-1;
			for (; i-4 >= r; i -= 4) {
				a[i] = a[i-len];
				a[i-1] = a[i-len-1];
				a[i-2] = a[i-len-2];
				a[i-3] = a[i-len-3];
			}
			for (; i >= r; i--) {
				a[i] = a[i-len];
			}
		} else {
			int x = readInt(); x--;
			res ^= a[x];
		}
	}
	cout << res << '\n';
}

signed main() {
	ios::sync_with_stdio(0); cin.tie(0);

	int t = readInt();
	while (t--) {
		solve();
	}
	
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 188ms
memory: 3964kb

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