#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int nx=105, mod=1e9+7;
ll n, q, a[nx], t[nx], qs[nx], l[nx], r[nx], x[nx], res;
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
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 msk=0; msk<(1<<q); msk++)
{
ll sm=0;
for (int i=1; i<=n; i++) t[i]=a[i];
for (int i=0; i<q;i ++) if (msk&(1<<i)) for (int j=l[i]; j<=r[i]; j++) t[j]=t[j]^x[i];
for (int i=1; i<=n; i++) qs[i]=(qs[i-1]+t[i])%mod, res=(res+(((n+1)*qs[i])%mod*(qs[i]))%mod), sm+=qs[i];
sm=(sm*sm%mod);
sm=((-sm)%mod+mod)%mod;
res=(res+sm)%mod;
}
cout<<res;
}
# |
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 |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 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 |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
45 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
273 ms |
348 KB |
Output is correct |
2 |
Correct |
300 ms |
344 KB |
Output is correct |
3 |
Correct |
273 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
273 ms |
348 KB |
Output is correct |
2 |
Correct |
300 ms |
344 KB |
Output is correct |
3 |
Correct |
273 ms |
344 KB |
Output is correct |
4 |
Incorrect |
8 ms |
348 KB |
Output isn't correct |
5 |
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 |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
273 ms |
348 KB |
Output is correct |
10 |
Correct |
300 ms |
344 KB |
Output is correct |
11 |
Correct |
273 ms |
344 KB |
Output is correct |
12 |
Runtime error |
1 ms |
856 KB |
Execution killed with signal 11 |
13 |
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 |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
273 ms |
348 KB |
Output is correct |
10 |
Correct |
300 ms |
344 KB |
Output is correct |
11 |
Correct |
273 ms |
344 KB |
Output is correct |
12 |
Incorrect |
8 ms |
348 KB |
Output isn't correct |
13 |
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 |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Incorrect |
45 ms |
348 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |