Submission #793097

#TimeUsernameProblemLanguageResultExecution timeMemory
793097poustouflanXORanges (eJOI19_xoranges)Cpython 3
50 / 100
1070 ms26252 KiB
n, q = map(int, input().split())

A = list(map(int, input().split())) # scan results
doublepref = [0, 0]
for x in A:
    doublepref.append(doublepref[-2] ^ x)

for _ in range(q):
    q, i, j = map(int, input().split())
    if q == 1:
        # rescan
        A[i-1] = j
        doublepref = [0, 0]
        for x in A:
            doublepref.append(doublepref[-2] ^ x)
    else:
        # query
        if (j - i) % 2 == 1:
            print(0)
        else:
            print(doublepref[j+1] ^ doublepref[i-1])
#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...