#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e,f[1009],i,j,zx,xc,xr[(1<<10)][101],pas,mod=1000000007;
pair <pair <long long, long long>, long long> p[1009];
int main(){
ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
cin>>a;
for(i=1; i<=a; i++) cin>>f[i];
cin>>b;
for(i=0; i<b; i++){
cin>>p[i].first.first>>p[i].first.second>>p[i].second;
}
if(b<=10){
for(j=1; j<=a; j++) xr[0][j]=f[j];
for(i=1; i<(1<<b); i++){
for(zx=b-1; zx>=0; zx--){
if((i&(1<<zx))!=0) break;
}
for(j=1; j<=a; j++){
if(p[zx].first.first<=j&&j<=p[zx].first.second){
xr[i][j]=(xr[i-(1<<zx)][j]^p[zx].second);
}else{
xr[i][j]=xr[i-(1<<zx)][j];
}
}
}
for(i=0; i<(1<<b); i++){
for(j=1; j<=a; j++) xr[i][j]+=xr[i][j-1];
for(zx=1; zx<=a; zx++){
for(xc=zx-1; xc>=0; xc--){
pas+=(xr[i][xc]-xr[i][zx])*(xr[i][xc]-xr[i][zx]);
pas%=mod;
}
}
}
cout<<pas;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
4 ms |
1272 KB |
Output is correct |
4 |
Correct |
4 ms |
1144 KB |
Output is correct |
5 |
Correct |
4 ms |
1144 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
4 ms |
1272 KB |
Output is correct |
4 |
Correct |
4 ms |
1144 KB |
Output is correct |
5 |
Correct |
4 ms |
1144 KB |
Output is correct |
6 |
Correct |
99 ms |
1144 KB |
Output is correct |
7 |
Correct |
100 ms |
1236 KB |
Output is correct |
8 |
Correct |
100 ms |
1144 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
27 ms |
1144 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
4 ms |
1272 KB |
Output is correct |
4 |
Correct |
4 ms |
1144 KB |
Output is correct |
5 |
Correct |
4 ms |
1144 KB |
Output is correct |
6 |
Correct |
99 ms |
1144 KB |
Output is correct |
7 |
Correct |
100 ms |
1236 KB |
Output is correct |
8 |
Correct |
100 ms |
1144 KB |
Output is correct |
9 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
4 ms |
1272 KB |
Output is correct |
4 |
Correct |
4 ms |
1144 KB |
Output is correct |
5 |
Correct |
4 ms |
1144 KB |
Output is correct |
6 |
Correct |
99 ms |
1144 KB |
Output is correct |
7 |
Correct |
100 ms |
1236 KB |
Output is correct |
8 |
Correct |
100 ms |
1144 KB |
Output is correct |
9 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
4 ms |
1272 KB |
Output is correct |
4 |
Correct |
4 ms |
1144 KB |
Output is correct |
5 |
Correct |
4 ms |
1144 KB |
Output is correct |
6 |
Correct |
99 ms |
1144 KB |
Output is correct |
7 |
Correct |
100 ms |
1236 KB |
Output is correct |
8 |
Correct |
100 ms |
1144 KB |
Output is correct |
9 |
Incorrect |
27 ms |
1144 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |