This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int main() {
// cin.tie(0)->sync_with_stdio(0);
// cin.exceptions(cin.failbit);
int n;
cin >> n;
vector<int> vi(n);
for (auto &a : vi)
cin >> a;
struct qry {
int l, r, x;
};
int qs;
cin >> qs;
vector<qry> vq(qs);
for (auto &a : vq) {
cin >> a.l >> a.r >> a.x;
a.l--, a.r--;
}
int sm = 0;
// cout << "X\n";
for (int i = 0; i < (1 << qs); i++) {
vector<int> tmp(vi);
for (int j = 0; j < qs; j++)
if (i & (1 << j)) {
for (int k = vq[j].l; k <= vq[j].r; k++)
tmp[k] = tmp[k] ^ vq[j].x;
}
for (int j = 0; j < n; j++) {
for (int k = j; k < n; k++) {
int curs = 0;
for (int l = j; l <= k; l++)
curs += tmp[l];
sm += curs * curs;
}
}
}
cout << sm << "\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |