#include <bits/stdc++.h>
using namespace std;
#define LCBorz ios_base::sync_with_stdio(false); cin.tie(0);
#define int long long
#define all(x) x.begin(), x.end()
#define endl '\n'
const int N=200005;
const int INF=1e18;
const int mod=1e9+7;
int n,ans=0;
vector<int> v(N);
void cal(){
int total=0;
for(int i=0;i<n;i++){
int cnt=0;
for(int j=i;j<n;j++){
cnt+=v[j];
total+=cnt*cnt;
total%=mod;
}
}
ans+=total;
ans%=mod;
}
int32_t main() {
LCBorz;
cin>>n;
for(int i=0;i<n;i++){
cin>>v[i];
}
int q;cin>>q;
vector<int> a(q),b(q),c(q);
for(int i=0;i<q;i++){
cin>>a[i]>>b[i]>>c[i];
}
for(int mask=0;mask<(1<<q);mask++){
for(int i=0;i<q;i++){
if(mask&(1<<i)){
for(int j=a[i]-1;j<b[i];j++){
v[j]^=c[i];
}
}
}
cal();
for(int i=0;i<q;i++){
if(mask&(1<<i)){
for(int j=a[i]-1;j<b[i];j++){
v[j]^=c[i];
}
}
}
}
cout<<ans<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1884 KB |
Output is correct |
2 |
Correct |
1 ms |
1884 KB |
Output is correct |
3 |
Correct |
1 ms |
1884 KB |
Output is correct |
4 |
Correct |
1 ms |
1884 KB |
Output is correct |
5 |
Correct |
1 ms |
1884 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1884 KB |
Output is correct |
2 |
Correct |
1 ms |
1884 KB |
Output is correct |
3 |
Correct |
1 ms |
1884 KB |
Output is correct |
4 |
Correct |
1 ms |
1884 KB |
Output is correct |
5 |
Correct |
1 ms |
1884 KB |
Output is correct |
6 |
Correct |
17 ms |
1884 KB |
Output is correct |
7 |
Correct |
17 ms |
1884 KB |
Output is correct |
8 |
Correct |
17 ms |
1884 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
13 ms |
4188 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2066 ms |
1884 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1717 ms |
1880 KB |
Output is correct |
2 |
Correct |
1744 ms |
1880 KB |
Output is correct |
3 |
Correct |
1714 ms |
1880 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1717 ms |
1880 KB |
Output is correct |
2 |
Correct |
1744 ms |
1880 KB |
Output is correct |
3 |
Correct |
1714 ms |
1880 KB |
Output is correct |
4 |
Incorrect |
10 ms |
2136 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1884 KB |
Output is correct |
2 |
Correct |
1 ms |
1884 KB |
Output is correct |
3 |
Correct |
1 ms |
1884 KB |
Output is correct |
4 |
Correct |
1 ms |
1884 KB |
Output is correct |
5 |
Correct |
1 ms |
1884 KB |
Output is correct |
6 |
Correct |
17 ms |
1884 KB |
Output is correct |
7 |
Correct |
17 ms |
1884 KB |
Output is correct |
8 |
Correct |
17 ms |
1884 KB |
Output is correct |
9 |
Correct |
1717 ms |
1880 KB |
Output is correct |
10 |
Correct |
1744 ms |
1880 KB |
Output is correct |
11 |
Correct |
1714 ms |
1880 KB |
Output is correct |
12 |
Incorrect |
79 ms |
1880 KB |
Output isn't correct |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1884 KB |
Output is correct |
2 |
Correct |
1 ms |
1884 KB |
Output is correct |
3 |
Correct |
1 ms |
1884 KB |
Output is correct |
4 |
Correct |
1 ms |
1884 KB |
Output is correct |
5 |
Correct |
1 ms |
1884 KB |
Output is correct |
6 |
Correct |
17 ms |
1884 KB |
Output is correct |
7 |
Correct |
17 ms |
1884 KB |
Output is correct |
8 |
Correct |
17 ms |
1884 KB |
Output is correct |
9 |
Correct |
1717 ms |
1880 KB |
Output is correct |
10 |
Correct |
1744 ms |
1880 KB |
Output is correct |
11 |
Correct |
1714 ms |
1880 KB |
Output is correct |
12 |
Incorrect |
10 ms |
2136 KB |
Output isn't correct |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1884 KB |
Output is correct |
2 |
Correct |
1 ms |
1884 KB |
Output is correct |
3 |
Correct |
1 ms |
1884 KB |
Output is correct |
4 |
Correct |
1 ms |
1884 KB |
Output is correct |
5 |
Correct |
1 ms |
1884 KB |
Output is correct |
6 |
Correct |
17 ms |
1884 KB |
Output is correct |
7 |
Correct |
17 ms |
1884 KB |
Output is correct |
8 |
Correct |
17 ms |
1884 KB |
Output is correct |
9 |
Incorrect |
13 ms |
4188 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |