Submission #563991

# Submission time Handle Problem Language Result Execution time Memory
563991 2022-05-18T11:24:09 Z Stickfish Intergalactic ship (IZhO19_xorsum) C++17
9 / 100
2000 ms 2224 KB
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;

const int MAXN = 1008;
const ll MOD = 1000000007;
int a[MAXN];

signed main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    int q;
    cin >> q;
    vector<pair<pair<int, int>, int>> qrs(q);
    for (int i = 0; i < q; ++i) {
        cin >> qrs[i].first.first >> qrs[i].first.second >> qrs[i].second;
        --qrs[i].first.first;
    }
    ll ans = 0;
    for (int m = 0; m < (1 << q); ++m) {
        vector<int> b(n);
        for (int i = 0; i < n; ++i)
            b[i] = a[i];
        for (int j = 0; j < q; ++j) {
            if (m & (1 << j)) {
                auto [sg, x] = qrs[j];
                for (int i = sg.first; i < sg.second; ++i) {
                    b[i] ^= x;
                }
            }
        }
        for (int i = 0; i < n; ++i) {
            int sm = 0;
            for (int j = i; j < n; ++j) {
                sm += b[j];
                ans += 1ll * sm * sm;
                ans %= MOD;
                //cout << sm << ' ';
            }
        }
    }
    cout << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 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 0 ms 212 KB Output is correct
2 Correct 0 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 22 ms 280 KB Output is correct
7 Correct 21 ms 296 KB Output is correct
8 Correct 22 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 49 ms 2224 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2087 ms 212 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2074 ms 212 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2074 ms 212 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 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 22 ms 280 KB Output is correct
7 Correct 21 ms 296 KB Output is correct
8 Correct 22 ms 212 KB Output is correct
9 Execution timed out 2074 ms 212 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 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 22 ms 280 KB Output is correct
7 Correct 21 ms 296 KB Output is correct
8 Correct 22 ms 212 KB Output is correct
9 Execution timed out 2074 ms 212 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 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 22 ms 280 KB Output is correct
7 Correct 21 ms 296 KB Output is correct
8 Correct 22 ms 212 KB Output is correct
9 Incorrect 49 ms 2224 KB Output isn't correct
10 Halted 0 ms 0 KB -