結果

問題 No.1091 Range Xor Query
ユーザー tanon710tanon710
提出日時 2020-07-08 00:10:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 174 ms / 2,000 ms
コード長 506 bytes
コンパイル時間 344 ms
コンパイル使用メモリ 82,392 KB
実行使用メモリ 137,156 KB
最終ジャッジ日時 2024-04-09 21:41:12
合計ジャッジ時間 6,485 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
52,948 KB
testcase_01 AC 32 ms
52,900 KB
testcase_02 AC 32 ms
52,384 KB
testcase_03 AC 100 ms
112,716 KB
testcase_04 AC 103 ms
81,840 KB
testcase_05 AC 157 ms
133,640 KB
testcase_06 AC 50 ms
74,120 KB
testcase_07 AC 128 ms
104,372 KB
testcase_08 AC 152 ms
112,588 KB
testcase_09 AC 92 ms
84,624 KB
testcase_10 AC 137 ms
118,052 KB
testcase_11 AC 157 ms
126,428 KB
testcase_12 AC 140 ms
130,328 KB
testcase_13 AC 156 ms
108,120 KB
testcase_14 AC 141 ms
117,624 KB
testcase_15 AC 148 ms
129,432 KB
testcase_16 AC 113 ms
85,188 KB
testcase_17 AC 174 ms
123,644 KB
testcase_18 AC 71 ms
77,876 KB
testcase_19 AC 97 ms
108,448 KB
testcase_20 AC 146 ms
106,028 KB
testcase_21 AC 87 ms
78,004 KB
testcase_22 AC 159 ms
120,532 KB
testcase_23 AC 164 ms
137,156 KB
testcase_24 AC 166 ms
137,012 KB
testcase_25 AC 161 ms
119,032 KB
testcase_26 AC 164 ms
137,112 KB
testcase_27 AC 163 ms
137,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3

import sys
input=sys.stdin.readline

n,q=map(int,input().split())
arr=list(map(int,input().split()))
total=0
for i in range(n):
    total^=arr[i]
acum_left=[0]
for i in range(n):
    acum_left.append(acum_left[-1]^arr[i])
acum_right=[0]
for i in range(n-1,-1,-1):
    acum_right.append(acum_right[-1]^arr[i])
acum_right=acum_right+[0]
acum_right=acum_right[::-1]
for _ in range(q):
    l,r=map(int,input().split())
    print(total^acum_left[l-1]^acum_right[r+1])
0