Submission #838185

# Submission time Handle Problem Language Result Execution time Memory
838185 2023-08-26T10:05:59 Z BlockOG XORanges (eJOI19_xoranges) C++14
55 / 100
1000 ms 7148 KB
#include <iostream>

using namespace std;

unsigned int o[200008];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n, q; cin >> n >> q;
    for (int i = 0; i < n; i++) cin >> o[i];

    for (int it = 0; it < q; it++) {
        int code; cin >> code;
        if (code == 1) {
            int i; cin >> i >> o[--i];
        } else {
            int l, u; cin >> l >> u;
            if (!((u - l + 1) & 1)) {
                cout << 0 << endl;
                continue;
            }

            unsigned int res1 = 0, res2 = 0, res3 = 0, res4 = 0;
            int i = l - 1;
            for (; i < u; i += 8) res1 ^= o[i], res2 ^= o[i + 2], res3 ^= o[i + 4], res4 ^= o[i + 6];
            if (i - 2 >= u) res1 ^= o[i - 2];
            if (i - 4 >= u) res1 ^= o[i - 4];
            if (i - 6 >= u) res1 ^= o[i - 6];
            cout << ((res1 ^ res2) ^ (res3 ^ res4)) << endl;
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 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 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 7 ms 340 KB Output is correct
12 Correct 4 ms 340 KB Output is correct
13 Correct 7 ms 348 KB Output is correct
14 Correct 8 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 930 ms 2268 KB Output is correct
2 Correct 912 ms 7076 KB Output is correct
3 Correct 918 ms 7148 KB Output is correct
4 Execution timed out 1040 ms 4908 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 7 ms 340 KB Output is correct
12 Correct 4 ms 340 KB Output is correct
13 Correct 7 ms 348 KB Output is correct
14 Correct 8 ms 340 KB Output is correct
15 Correct 930 ms 2268 KB Output is correct
16 Correct 912 ms 7076 KB Output is correct
17 Correct 918 ms 7148 KB Output is correct
18 Execution timed out 1040 ms 4908 KB Time limit exceeded
19 Halted 0 ms 0 KB -