Submission #344187

# Submission time Handle Problem Language Result Execution time Memory
344187 2021-01-05T08:43:09 Z Rakhmand Intergalactic ship (IZhO19_xorsum) C++14
9 / 100
2000 ms 1636 KB
//
//  C.cpp
//  torelax
//
//  Created by Rakhman on 1/5/21.
//

#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <iterator>

#define ios ios_base::sync_with_stdio(0), cout.tie(0), cin.tie(0);
#define S second
#define F first
#define pb push_back
#define nl '\n'
#define NL cout << '\n';
#define EX exit(0)
#define all(s) s.begin(), s.end()
#define no_answer {cout << "NO"; exit(0);}
#define FOR(i, start, finish, k) for(llong i = start; i <= finish; i += k)

const long long mxn = 1e6 + 110;
const long long mnn = 1e3 + 2;
const long long mod = 1e9 + 7;
const long long inf = 1e18;
const long long OO = 1e9;

typedef long long llong;
typedef unsigned long long ullong;

using namespace std;

int n, Q;
int b[mxn], k[mxn];

struct query{
    int l, r, x;
}q[mxn];

int main(){
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> b[i];
    }
    cin >> Q;
    for(int i = 1; i <= Q; i++){
        cin >> q[i].l >> q[i].r >> q[i].x;
    }
    llong ans = 0;
    for(int mask = 0; mask < (1 << Q); mask++){
        for(int i = 1; i <= n; i++){
            k[i] = b[i];
        }
        for(int j = 0; j < Q; j++){
            if((1 << j) & mask){
                for(int i = q[j + 1].l; i <= q[j + 1].r; i++){
                    k[i] ^= q[j + 1].x;
                }
            }
        }
        for(int i = 1; i <= n; i++){
            llong sum = 0;
            for(int j = i; j <= n; j++){
                sum += k[j];
                ans = (ans + sum * sum) % mod;
            }
        }
    }
    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 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 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 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 20 ms 364 KB Output is correct
7 Correct 20 ms 364 KB Output is correct
8 Correct 20 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 56 ms 1636 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2086 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2021 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2021 ms 364 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 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 20 ms 364 KB Output is correct
7 Correct 20 ms 364 KB Output is correct
8 Correct 20 ms 364 KB Output is correct
9 Execution timed out 2021 ms 364 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 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 20 ms 364 KB Output is correct
7 Correct 20 ms 364 KB Output is correct
8 Correct 20 ms 364 KB Output is correct
9 Execution timed out 2021 ms 364 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 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 20 ms 364 KB Output is correct
7 Correct 20 ms 364 KB Output is correct
8 Correct 20 ms 364 KB Output is correct
9 Incorrect 56 ms 1636 KB Output isn't correct
10 Halted 0 ms 0 KB -