Submission #838193

#TimeUsernameProblemLanguageResultExecution timeMemory
838193BlockOGXORanges (eJOI19_xoranges)C++14
0 / 100
683 ms2284 KiB
#include <iostream> using namespace std; unsigned int o[200100]; 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, res5 = 0, res6 = 0, res7 = 0, res8 = 0; int i = l - 1; for (; i < u; i += 16) { res1 ^= o[i + 0 ]; res2 ^= o[i + 2 ]; res3 ^= o[i + 4 ]; res4 ^= o[i + 6 ]; res5 ^= o[i + 8 ]; res6 ^= o[i + 10]; res7 ^= o[i + 12]; res8 ^= o[i + 14]; } if (i - 2 >= u) res1 ^= o[i - 2 ]; if (i - 4 >= u) res1 ^= o[i - 4 ]; if (i - 6 >= u) res1 ^= o[i - 6 ]; if (i - 8 >= u) res1 ^= o[i - 8 ]; if (i - 10 >= u) res1 ^= o[i - 10]; if (i - 12 >= u) res1 ^= o[i - 12]; if (i - 14 >= u) res1 ^= o[i - 14]; cout << ((res1 ^ res2) ^ (res3 ^ res4)) << endl; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...