QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#45431 | #4389. Copy | miaomiaozi | AC ✓ | 1680ms | 5492kb | C++17 | 1.4kb | 2022-08-23 19:42:55 | 2022-08-23 19:42:57 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
// https://space.bilibili.com/672346917
#ifndef LOCAL
#define LOG(...) 42
#endif
#define fi first
#define se second
#define pb push_back
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long LL;
typedef pair <int, int> PII;
constexpr int inf = 0x3f3f3f3f;
constexpr double EPS = 1e-8;
const double PI = acos(-1);
int multi_cases = 1;
void A_SOUL_AvA () {
int n, q;
cin >> n >> q;
vector <int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int ans = 0;
while (q--) {
int op;
cin >> op;
if (op == 1) {
int l, r;
cin >> l >> r;
l--, r--;
auto b = vector(a.begin(), a.begin() + r + 1);
for (int i = l; i <= r && b.size() < n; i++) {
b.pb(a[i]);
}
for (int i = r + 1; i < n && b.size() < n; i++) {
b.pb(a[i]);
}
a = b;
} else {
int x;
cin >> x;
ans ^= a[x - 1];
}
}
cout << ans << endl;
}
int main () {
cin.tie(nullptr)->sync_with_stdio(false);
cout << fixed << setprecision(12);
int T = 1;
for (multi_cases && cin >> T; T; T--) {
A_SOUL_AvA ();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1680ms
memory: 5492kb
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