#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll M = 1e5+7;
const ll inf = 1e9;
const ll mod = 1e9+7;
int n,q;
int a[M],l[M],r[M],x[M];
ll b[M];
ll ans;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> n;
for (int i=1; i<=n; i++) cin >> a[i];
cin >> q;
for (int i=0; i<q; i++) cin >> l[i] >> r[i] >> x[i];
for (int m=0; m<(1<<q); m++){
for (int i=1; i<=n; i++) b[i] = 0;
for (int i=0; i<q; i++)
if (1<<i&m) b[l[i]] ^= x[i], b[r[i]+1] ^= x[i];
for (int i=1; i<=n; i++) b[i] ^= b[i-1];
for (int i=1; i<=n; i++) b[i] ^= a[i];
for (int i=1; i<=n; i++) for (int j=1; j<=n; j++) ans = (ans + b[i]*b[j]*min(i,j)*(n-max(i,j)+1))%mod;
}
cout << ans << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
332 KB |
Output is correct |
6 |
Correct |
48 ms |
332 KB |
Output is correct |
7 |
Correct |
48 ms |
332 KB |
Output is correct |
8 |
Correct |
48 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
1508 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2084 ms |
332 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2090 ms |
332 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2090 ms |
332 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
332 KB |
Output is correct |
6 |
Correct |
48 ms |
332 KB |
Output is correct |
7 |
Correct |
48 ms |
332 KB |
Output is correct |
8 |
Correct |
48 ms |
332 KB |
Output is correct |
9 |
Execution timed out |
2090 ms |
332 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
332 KB |
Output is correct |
6 |
Correct |
48 ms |
332 KB |
Output is correct |
7 |
Correct |
48 ms |
332 KB |
Output is correct |
8 |
Correct |
48 ms |
332 KB |
Output is correct |
9 |
Execution timed out |
2090 ms |
332 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
332 KB |
Output is correct |
6 |
Correct |
48 ms |
332 KB |
Output is correct |
7 |
Correct |
48 ms |
332 KB |
Output is correct |
8 |
Correct |
48 ms |
332 KB |
Output is correct |
9 |
Incorrect |
20 ms |
1508 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |