Submission #334554

# Submission time Handle Problem Language Result Execution time Memory
334554 2020-12-09T11:43:54 Z Trickster Intergalactic ship (IZhO19_xorsum) C++14
9 / 100
2000 ms 262148 KB
//Suleyman Atayew
 
#include <algorithm>
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <bitset>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <set>
 
#define N 200010
#define ff first
#define ss second
#define pb push_back
#define ll long long
#define mod 1000000007
#define pii pair <ll, ll>
#define sz(a) (ll)(a.size())
ll bigmod(ll a, ll b) { if(b==0)return 1; ll ret = bigmod(a, b/2); return ret * ret % mod * (b%2 ? a : 1) % mod; }

using namespace std;

struct st {
    ll l, r, x;
} p[N];

ll n, q, ans;
ll v[N];
ll arr[N];

void f(ll x)
{
    if(x == q+1) {
        ll A[N];
        for(ll i = 1; i <= n; i++) A[i] = v[i];

        for(ll i = 1; i <= q; i++) if(arr[i]) for(ll h = p[i].l; h <= p[i].r; h++) A[h] ^= p[i].x;

        for(ll i = 1; i <= n; i++) A[i] += A[i-1];

        for(ll i = 1; i <= n; i++)
            for(ll h = i; h <= n; h++)
                ans = (ans + (A[h]-A[i-1]) * (A[h]-A[i-1])%mod)%mod;

        return;
    }

    for(ll i = 0; i <= 1; i++) {
        arr[x] = i;
        f(x+1);
    }
}

int main()
{
    ios::sync_with_stdio(false);
	cin.tie(0);
    
    cin >> n;

    for(ll i = 1; i <= n; i++) cin >> v[i];

    cin >> q;

    for(ll i = 1; i <= q; i++) cin >> p[i].l >> p[i].r >> p[i].x;

    f(1);

    cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 1 ms 492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 1 ms 492 KB Output is correct
6 Correct 25 ms 492 KB Output is correct
7 Correct 28 ms 492 KB Output is correct
8 Correct 25 ms 492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 196 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2082 ms 4076 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2045 ms 620 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2045 ms 620 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 1 ms 492 KB Output is correct
6 Correct 25 ms 492 KB Output is correct
7 Correct 28 ms 492 KB Output is correct
8 Correct 25 ms 492 KB Output is correct
9 Execution timed out 2045 ms 620 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 1 ms 492 KB Output is correct
6 Correct 25 ms 492 KB Output is correct
7 Correct 28 ms 492 KB Output is correct
8 Correct 25 ms 492 KB Output is correct
9 Execution timed out 2045 ms 620 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 1 ms 492 KB Output is correct
6 Correct 25 ms 492 KB Output is correct
7 Correct 28 ms 492 KB Output is correct
8 Correct 25 ms 492 KB Output is correct
9 Runtime error 196 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
10 Halted 0 ms 0 KB -