#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int32_t 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];
curs %= mod;
}
sm += curs * curs % mod;
sm %= mod;
}
}
}
cout << sm << "\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
554 ms |
348 KB |
Output is correct |
7 |
Correct |
554 ms |
348 KB |
Output is correct |
8 |
Correct |
568 ms |
408 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
29 ms |
1368 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2037 ms |
348 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2040 ms |
344 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2040 ms |
344 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
554 ms |
348 KB |
Output is correct |
7 |
Correct |
554 ms |
348 KB |
Output is correct |
8 |
Correct |
568 ms |
408 KB |
Output is correct |
9 |
Execution timed out |
2040 ms |
344 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
554 ms |
348 KB |
Output is correct |
7 |
Correct |
554 ms |
348 KB |
Output is correct |
8 |
Correct |
568 ms |
408 KB |
Output is correct |
9 |
Execution timed out |
2040 ms |
344 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
554 ms |
348 KB |
Output is correct |
7 |
Correct |
554 ms |
348 KB |
Output is correct |
8 |
Correct |
568 ms |
408 KB |
Output is correct |
9 |
Incorrect |
29 ms |
1368 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |