QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#45432 | #4389. Copy | miaomiaozi | AC ✓ | 75ms | 4816kb | C++17 | 1.6kb | 2022-08-23 20:43:54 | 2022-08-23 20:43:55 |
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;
constexpr int N = 100010;
void A_SOUL_AvA () {
int n, q;
cin >> n >> q;
vector <int> a(n + 1);
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
bitset <N> f;
int ans = 0;
vector <array<int, 3>> query(q);
for (int i = 0; i < q; i++) {
int op;
cin >> op;
if (op == 1) {
int l, r;
cin >> l >> r;
query[i] = {op, l, r};
} else {
int x;
cin >> x;
query[i] = {op, x, 0};
}
}
reverse(all(query));
for (auto &[op, l, r] : query) {
if (op == 1) {
auto low = ~bitset<N>(0) >> (N - (r + 1)) & f;
auto high = f ^ low;
f = low ^ high >> (r - l + 1);
} else {
f[l] = !f[l];
}
}
for (int i = 1; i <= n; i++) {
if (f[i]) {
ans ^= a[i];
}
}
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;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 75ms
memory: 4816kb
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