QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#57659 | #4389. Copy | qinjianbin# | AC ✓ | 114ms | 5480kb | C++17 | 915b | 2022-10-22 16:36:53 | 2022-10-22 16:36:55 |
Judging History
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;
}
Details
Tip: Click on the bar to expand more detailed information
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