Submission #437389

# Submission time Handle Problem Language Result Execution time Memory
437389 2021-06-26T09:10:17 Z MinhQNgo XORanges (eJOI19_xoranges) C++17
18 / 100
39 ms 460 KB
#include <bits/stdc++.h>

using namespace std;

const int N = 505;

int a[N];
long long p[N];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);

    int n, q;
    cin >> n >> q;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        p[i] = p[i - 1] ^ a[i];
    }
    for (int _ = 0; _ < q; _++) {
        int t, x, y;
        cin >> t >> x >> y;
        if (t == 1) a[x] = y;
        else {
            long long ans = 0;
            for (int l = 1; l <= y - x + 1; l++) {
                long long cur_xor = 0;
                for (int i = x; i + l - 1 <= y; i++) {
                    cur_xor ^= p[i + l - 1] ^ p[i - 1];
                }
                ans ^= cur_xor;
            }
            cout << ans << '\n';
        }
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 328 KB Output is correct
2 Correct 10 ms 332 KB Output is correct
3 Correct 10 ms 336 KB Output is correct
4 Correct 39 ms 324 KB Output is correct
5 Correct 38 ms 328 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 460 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -