#include<bits/stdc++.h>
using namespace std;
const int MOD=1e9+7;
signed main(){
int n;
cin>>n;
vector<int>a(n);
for(int i=0;i<n;i++) cin>>a[i];
int q;
cin>>q;
vector<array<int,3>>queries(q);
long long ans=0;
for(int i=0;i<q;i++){
cin>>queries[i][0]>>queries[i][1]>>queries[i][2];
}
for(int mask=0;mask<(1<<q);mask++){
vector<int>b=a;
for(int i=0;i<q;i++){
if(mask>>i & 1){
for(int j=queries[i][0]-1;j<queries[i][1];j++) b[j]^=queries[i][2];
}
}
for(int i=0;i<n;i++){
long long s=0;
for(int j=i;j<n;j++){
s+=b[j];
ans+=s*s;
ans%=MOD;
}
}
}
cout<<ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 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 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 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 |
17 ms |
344 KB |
Output is correct |
7 |
Correct |
17 ms |
436 KB |
Output is correct |
8 |
Correct |
18 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
30 ms |
1624 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2082 ms |
348 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1679 ms |
344 KB |
Output is correct |
2 |
Correct |
1685 ms |
408 KB |
Output is correct |
3 |
Correct |
1666 ms |
412 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1679 ms |
344 KB |
Output is correct |
2 |
Correct |
1685 ms |
408 KB |
Output is correct |
3 |
Correct |
1666 ms |
412 KB |
Output is correct |
4 |
Incorrect |
5 ms |
448 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 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 |
17 ms |
344 KB |
Output is correct |
7 |
Correct |
17 ms |
436 KB |
Output is correct |
8 |
Correct |
18 ms |
348 KB |
Output is correct |
9 |
Correct |
1679 ms |
344 KB |
Output is correct |
10 |
Correct |
1685 ms |
408 KB |
Output is correct |
11 |
Correct |
1666 ms |
412 KB |
Output is correct |
12 |
Incorrect |
73 ms |
348 KB |
Output isn't correct |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 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 |
17 ms |
344 KB |
Output is correct |
7 |
Correct |
17 ms |
436 KB |
Output is correct |
8 |
Correct |
18 ms |
348 KB |
Output is correct |
9 |
Correct |
1679 ms |
344 KB |
Output is correct |
10 |
Correct |
1685 ms |
408 KB |
Output is correct |
11 |
Correct |
1666 ms |
412 KB |
Output is correct |
12 |
Incorrect |
5 ms |
448 KB |
Output isn't correct |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 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 |
17 ms |
344 KB |
Output is correct |
7 |
Correct |
17 ms |
436 KB |
Output is correct |
8 |
Correct |
18 ms |
348 KB |
Output is correct |
9 |
Incorrect |
30 ms |
1624 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |