n, q = map(int, input().split())
a = [int(x) for x in input().split()]
prefix_xor = a[:]
for i in range(1, n):
prefix_xor[i] ^= prefix_xor[i - 1]
for _ in range(q):
act_type, x, y = map(int, input().split())
x -= 1
y -= 1
res = 0
for d in range(1, y - x + 2):
total_xor_of_seq_len_d = 0
for i in range(x, y - d + 2):
if i == 0:
total_xor_of_seq_len_d ^= prefix_xor[i + d - 1]
else:
total_xor_of_seq_len_d ^= (prefix_xor[i + d - 1] ^ prefix_xor[i - 1])
res ^= total_xor_of_seq_len_d
print(res)
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
51 ms |
20268 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
83 ms |
21048 KB |
Output is correct |
2 |
Correct |
80 ms |
21296 KB |
Output is correct |
3 |
Correct |
88 ms |
21292 KB |
Output is correct |
4 |
Correct |
186 ms |
21948 KB |
Output is correct |
5 |
Correct |
178 ms |
21672 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
51 ms |
20268 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1010 ms |
38276 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
51 ms |
20268 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |