이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |