#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
using namespace std;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less_equal<ll>,
rb_tree_tag, tree_order_statistics_node_update>
TREE;
ll sum(ll in,ll fi,vector<ll> a){
ll su = 0;
for(int i = in; i <= fi; i++){
su += a[i];
su %= MOD;
}
return su;
}
ll K(vector<ll> a){
ll n = a.size();
ll su = 0;
for(int i = 0; i < n; i++){
for(int j = i; j < n; j++){
su+= (sum(i,j,a) * sum(i,j,a))%MOD;
su %= MOD;
}
}
return su;
}
int main()
{
int n;
cin >> n ;
vector<ll> a(n);
for(int i =0; i < n; i++){
cin >> a[i];
}
int q;
cin >> q;
vector<pair<pair<ll,ll>,ll>> act(q);
for(int i = 0; i < q; i++){
cin >> act[i].first.first >> act[i].first.second >> act[i].second;
}
ll su = 0;
for(int i = 0 ; i < (1ll <<q); i++){
vector<ll> temp = a;
for(int j = 0; j < q; j++){
if(i & (1ll << j)){
for(ll i = act[j].first.first-1; i <= act[j].first.second-1; i++){
temp[j] ^= act[j].second;
}
}
}
su += K(temp);
su %= MOD;
}
cout << su << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
3 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
3 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
39 ms |
6228 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2084 ms |
344 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2029 ms |
344 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2029 ms |
344 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
3 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
3 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
3 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |