#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,f[1009],i,j,zx,xc,xr[(1<<10)][101],pas;
pair <pair <int, int>, int> 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;
}
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]);
}
}
}
cout<<pas;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
588 KB |
Output is correct |
2 |
Correct |
2 ms |
380 KB |
Output is correct |
3 |
Incorrect |
2 ms |
760 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
588 KB |
Output is correct |
2 |
Correct |
2 ms |
380 KB |
Output is correct |
3 |
Incorrect |
2 ms |
760 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
26 ms |
1572 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
4 ms |
1400 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
4 ms |
1400 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
4 ms |
1400 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
588 KB |
Output is correct |
2 |
Correct |
2 ms |
380 KB |
Output is correct |
3 |
Incorrect |
2 ms |
760 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
588 KB |
Output is correct |
2 |
Correct |
2 ms |
380 KB |
Output is correct |
3 |
Incorrect |
2 ms |
760 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
588 KB |
Output is correct |
2 |
Correct |
2 ms |
380 KB |
Output is correct |
3 |
Incorrect |
2 ms |
760 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |