#include<bits/stdc++.h>
#define ll long long
using namespace std ;
const ll mod = 1e9 + 7 ;
signed main()
{
ios_base::sync_with_stdio( 0 ) ;
cin.tie( 0 ) ;
cout.tie( 0 ) ;
ll n, q, all = 0 ;
cin >> n ;
ll a[n + 1] ;
for(ll i = 1 ; i <= n ; i++)
cin >> a[i] ;
cin >> q ;
ll l[q + 1], r[q + 1], x[q + 1] ;
for(ll i = 0 ; i < q ; i++)
cin >> l[i] >> r[i] >> x[i] ;
for(ll i = 0 ; i < (1 << q) ; i++)
{
ll pref[n + 1] = {} ;
for(ll j = 0 ; j < q ; j++)
if((1 << j) & i)
{
for(ll z = l[j] ; z <= r[j] ; z++)
a[z] ^= x[j] ;
}
for(int j = 1 ; j <= n ; j++)
pref[j] = pref[j - 1] + a[j] ;
for(int j = 1 ; j <= n ; j++)
for(int z = j ; z <= n ; z++)
{
all += (pref[z] - pref[j - 1]) * (pref[z] - pref[j - 1]) ;
all %= mod ;
}
for(ll j = 0 ; j < q ; j++)
if((1 << j) & i)
{
for(ll z = l[j] ; z <= r[j] ; z++)
a[z] ^= x[j] ;
}
}
cout << all ;
return 0 ;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
17 ms |
320 KB |
Output is correct |
7 |
Correct |
17 ms |
212 KB |
Output is correct |
8 |
Correct |
18 ms |
300 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
14 ms |
3412 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2058 ms |
340 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1791 ms |
300 KB |
Output is correct |
2 |
Correct |
1810 ms |
308 KB |
Output is correct |
3 |
Correct |
1795 ms |
296 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1791 ms |
300 KB |
Output is correct |
2 |
Correct |
1810 ms |
308 KB |
Output is correct |
3 |
Correct |
1795 ms |
296 KB |
Output is correct |
4 |
Incorrect |
9 ms |
468 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
17 ms |
320 KB |
Output is correct |
7 |
Correct |
17 ms |
212 KB |
Output is correct |
8 |
Correct |
18 ms |
300 KB |
Output is correct |
9 |
Correct |
1791 ms |
300 KB |
Output is correct |
10 |
Correct |
1810 ms |
308 KB |
Output is correct |
11 |
Correct |
1795 ms |
296 KB |
Output is correct |
12 |
Incorrect |
80 ms |
316 KB |
Output isn't correct |
13 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
17 ms |
320 KB |
Output is correct |
7 |
Correct |
17 ms |
212 KB |
Output is correct |
8 |
Correct |
18 ms |
300 KB |
Output is correct |
9 |
Correct |
1791 ms |
300 KB |
Output is correct |
10 |
Correct |
1810 ms |
308 KB |
Output is correct |
11 |
Correct |
1795 ms |
296 KB |
Output is correct |
12 |
Incorrect |
9 ms |
468 KB |
Output isn't correct |
13 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
17 ms |
320 KB |
Output is correct |
7 |
Correct |
17 ms |
212 KB |
Output is correct |
8 |
Correct |
18 ms |
300 KB |
Output is correct |
9 |
Incorrect |
14 ms |
3412 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |